Browse Source

feat: create @abp/utils package

pull/3415/head
mehmet-erim 7 years ago
parent
commit
67f6f5d153
  1. 16
      npm/packs/utils/.editorconfig
  2. 50
      npm/packs/utils/.gitignore
  3. 5
      npm/packs/utils/.prettierrc
  4. 1
      npm/packs/utils/README.md
  5. 50
      npm/packs/utils/angular.json
  6. 59
      npm/packs/utils/package.json
  7. 12
      npm/packs/utils/prepublish.js
  8. 32
      npm/packs/utils/projects/utils/karma.conf.js
  9. 7
      npm/packs/utils/projects/utils/ng-package.json
  10. 3
      npm/packs/utils/projects/utils/src/lib/linked-list.ts
  11. 5
      npm/packs/utils/projects/utils/src/public-api.ts
  12. 26
      npm/packs/utils/projects/utils/src/test.ts
  13. 18
      npm/packs/utils/projects/utils/tsconfig.lib.json
  14. 17
      npm/packs/utils/projects/utils/tsconfig.spec.json
  15. 29
      npm/packs/utils/tsconfig.json
  16. 136
      npm/packs/utils/tslint.json
  17. 4631
      npm/packs/utils/yarn.lock

16
npm/packs/utils/.editorconfig

@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false

50
npm/packs/utils/.gitignore

@ -0,0 +1,50 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
/lib
# dependencies
/node_modules
# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db
projects/utils/README.md
projects/utils/package.json

5
npm/packs/utils/.prettierrc

@ -0,0 +1,5 @@
{
"singleQuote": true,
"printWidth": 100,
"trailingComma": "all"
}

1
npm/packs/utils/README.md

@ -0,0 +1 @@
# @abp/utils

50
npm/packs/utils/angular.json

@ -0,0 +1,50 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"utils": {
"projectType": "library",
"root": "projects/utils",
"sourceRoot": "projects/utils/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/utils/tsconfig.lib.json",
"project": "projects/utils/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/utils/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/utils/src/test.ts",
"tsConfig": "projects/utils/tsconfig.spec.json",
"karmaConfig": "projects/utils/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/utils/tsconfig.lib.json",
"projects/utils/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}},
"cli": {
"analytics": false
},
"defaultProject": "utils"
}

59
npm/packs/utils/package.json

@ -0,0 +1,59 @@
{
"name": "@abp/utils",
"version": "0.0.2",
"scripts": {
"prepublish": "node prepublish.js",
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint"
},
"publishConfig": {
"access": "public"
},
"files": [
"dist/*"
],
"main": "lib/bundles/abp-utils.umd.js",
"module": "lib/fesm5/abp-utils.js",
"es2015": "lib/fesm2015/abp-utils.js",
"esm5": "lib/esm5/abp-utils.js",
"esm2015": "lib/esm2015/abp-utils.js",
"fesm5": "lib/fesm5/abp-utils.js",
"fesm2015": "lib/fesm2015/abp-utils.js",
"typings": "lib/abp-utils.d.ts",
"metadata": "lib/abp-utils.metadata.json",
"sideEffects": false,
"devDependencies": {
"@angular-devkit/build-ng-packagr": "~0.901.0",
"@angular/cli": "~9.1.0",
"@angular/compiler": "~9.1.0",
"@angular/compiler-cli": "~9.1.0",
"@angular/core": "~9.1.0",
"@types/execa": "^2.0.0",
"@types/fs-extra": "^8.1.0",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"execa": "^4.0.0",
"fs-extra": "^9.0.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.4.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"ng-packagr": "^9.0.0",
"protractor": "~5.4.3",
"ts-node": "~8.3.0",
"tslib": "^1.10.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3"
},
"peerDependencies": {
"tslib": "^1.10.0"
}
}

12
npm/packs/utils/prepublish.js

@ -0,0 +1,12 @@
const fse = require('fs-extra');
const execa = require('execa');
fse.copyFileSync('./package.json', './projects/utils/package.json');
fse.copyFileSync('./README.md', './projects/utils/README.md');
try {
execa.sync('yarn', ['build'], { stdout: 'inherit' });
} catch (error) {
console.error(error);
process.exit(1);
}

32
npm/packs/utils/projects/utils/karma.conf.js

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/utils'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

7
npm/packs/utils/projects/utils/ng-package.json

@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist",
"lib": {
"entryFile": "src/public-api.ts"
}
}

3
npm/packs/utils/projects/utils/src/lib/linked-list.ts

@ -0,0 +1,3 @@
export class LinkedList {
constructor() {}
}

5
npm/packs/utils/projects/utils/src/public-api.ts

@ -0,0 +1,5 @@
/*
* Public API Surface of utils
*/
export * from './lib/linked-list';

26
npm/packs/utils/projects/utils/src/test.ts

@ -0,0 +1,26 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

18
npm/packs/utils/projects/utils/tsconfig.lib.json

@ -0,0 +1,18 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true,
"enableIvy": false
},
"exclude": ["src/test.ts", "**/*.spec.ts"]
}

17
npm/packs/utils/projects/utils/tsconfig.spec.json

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

29
npm/packs/utils/tsconfig.json

@ -0,0 +1,29 @@
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"lib": [
"es2018",
"dom"
],
"paths": {
"utils": [
"dist/utils/utils",
"dist/utils"
]
}
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}

136
npm/packs/utils/tslint.json

@ -0,0 +1,136 @@
{
"extends": "tslint:recommended",
"rulesDirectory": [
"codelyzer"
],
"rules": {
"align": {
"options": [
"parameters",
"statements"
]
},
"array-type": false,
"arrow-return-shorthand": true,
"curly": true,
"deprecation": {
"severity": "warning"
},
"eofline": true,
"import-blacklist": [
true,
"rxjs/Rx"
],
"import-spacing": true,
"indent": {
"options": [
"spaces"
]
},
"max-classes-per-file": false,
"max-line-length": [
true,
140
],
"member-ordering": [
true,
{
"order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-empty": false,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-non-null-assertion": true,
"no-redundant-jsdoc": true,
"no-switch-case-fall-through": true,
"no-var-requires": false,
"object-literal-key-quotes": [
true,
"as-needed"
],
"quotemark": [
true,
"single"
],
"semicolon": {
"options": [
"always"
]
},
"space-before-function-paren": {
"options": {
"anonymous": "never",
"asyncArrow": "always",
"constructor": "never",
"method": "never",
"named": "never"
}
},
"typedef-whitespace": {
"options": [
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
},
{
"call-signature": "onespace",
"index-signature": "onespace",
"parameter": "onespace",
"property-declaration": "onespace",
"variable-declaration": "onespace"
}
]
},
"variable-name": {
"options": [
"ban-keywords",
"check-format",
"allow-pascal-case"
]
},
"whitespace": {
"options": [
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type",
"check-typecast"
]
},
"component-class-suffix": true,
"contextual-lifecycle": true,
"directive-class-suffix": true,
"no-conflicting-lifecycle": true,
"no-host-metadata-property": true,
"no-input-rename": true,
"no-inputs-metadata-property": true,
"no-output-native": true,
"no-output-on-prefix": true,
"no-output-rename": true,
"no-outputs-metadata-property": true,
"template-banana-in-box": true,
"template-no-negated-async": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true
}
}

4631
npm/packs/utils/yarn.lock

File diff suppressed because it is too large
Loading…
Cancel
Save