diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index 9451ef1554..2f441106c2 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -4,28 +4,35 @@ "lerna": "lerna" }, "devDependencies": { + "@angular-devkit/build-angular": "~0.801.2", + "@angular-devkit/build-ng-packagr": "~0.801.2", "@angular/animations": "~8.1.2", + "@angular/cdk": "^8.0.1", + "@angular/cli": "~8.1.2", "@angular/common": "~8.1.2", "@angular/compiler": "~8.1.2", + "@angular/compiler-cli": "~8.1.2", "@angular/core": "~8.1.2", "@angular/forms": "~8.1.2", + "@angular/language-service": "~8.1.2", "@angular/platform-browser": "~8.1.2", "@angular/platform-browser-dynamic": "~8.1.2", "@angular/router": "~8.1.2", - "rxjs": "~6.4.0", - "tslib": "^1.9.0", - "zone.js": "~0.9.1", - "@angular-devkit/build-angular": "~0.801.2", - "@angular-devkit/build-ng-packagr": "~0.801.2", - "@angular/cli": "~8.1.2", - "@angular/compiler-cli": "~8.1.2", - "@angular/language-service": "~8.1.2", + "@ng-bootstrap/ng-bootstrap": "^5.0.0-rc.1", + "@ngx-validate/core": "^0.0.1", + "@ngxs/router-plugin": "^3.5.0", + "@ngxs/storage-plugin": "^3.5.0", + "@ngxs/store": "^3.5.0", "@types/jasmine": "~3.3.8", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", + "angular-oauth2-oidc": "^8.0.1", + "bootstrap": "^4.3.1", "codelyzer": "^5.0.0", + "font-awesome": "^4.7.0", "jasmine-core": "~3.4.0", "jasmine-spec-reporter": "~4.2.1", + "just-compare": "^1.3.0", "karma": "~4.1.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", @@ -33,25 +40,18 @@ "karma-jasmine-html-reporter": "^1.4.0", "lerna": "^3.16.4", "ng-packagr": "^5.1.0", + "ngx-perfect-scrollbar": "^8.0.0", + "primeicons": "^1.0.0", + "primeng": "^8.0.0", "protractor": "~5.4.0", - "symlink-manager": "^1.1.2", + "rxjs": "~6.4.0", + "snq": "^1.0.3", + "symlink-manager": "^1.2.0", "ts-node": "~7.0.0", "tsickle": "^0.35.0", + "tslib": "^1.9.0", "tslint": "~5.15.0", "typescript": "~3.4.3", - "@ngxs/router-plugin": "^3.5.0", - "@ngxs/storage-plugin": "^3.5.0", - "@ngxs/store": "^3.5.0", - "angular-oauth2-oidc": "^8.0.1", - "just-compare": "^1.3.0", - "snq": "^1.0.3", - "@angular/cdk": "^8.0.1", - "@ng-bootstrap/ng-bootstrap": "^5.0.0-rc.1", - "@ngx-validate/core": "^0.0.1", - "bootstrap": "^4.3.1", - "font-awesome": "^4.7.0", - "ngx-perfect-scrollbar": "^8.0.0", - "primeicons": "^1.0.0", - "primeng": "^8.0.0" + "zone.js": "~0.9.1" } } diff --git a/npm/ng-packs/scripts/.yarn.js b/npm/ng-packs/scripts/.yarn.js new file mode 100644 index 0000000000..1961f886a5 --- /dev/null +++ b/npm/ng-packs/scripts/.yarn.js @@ -0,0 +1,28 @@ +"use strict" + +const child_process = require("child_process") +const { env } = process +const { parent } = module + +const REQUIRE_ESM = "--require esm" +const REQUIRE_DOT_YARN = "--require ./.yarn.js" + +let { NODE_OPTIONS } = env + +if (typeof NODE_OPTIONS === "string") { + NODE_OPTIONS += " " +} else { + NODE_OPTIONS = "" +} + +if (parent != null && + parent.id === "internal/preload") { + env.NODE_OPTIONS = NODE_OPTIONS.replace(REQUIRE_DOT_YARN, REQUIRE_ESM) +} else { + child_process.spawn("yarn", process.argv.slice(2), { + env: Object.assign({}, env, { + NODE_OPTIONS: REQUIRE_DOT_YARN + " " + NODE_OPTIONS + }), + stdio: "inherit" + }) +} diff --git a/npm/ng-packs/scripts/.yarnrc b/npm/ng-packs/scripts/.yarnrc new file mode 100644 index 0000000000..8db01eba40 --- /dev/null +++ b/npm/ng-packs/scripts/.yarnrc @@ -0,0 +1 @@ +yarn-path "./.yarn.js" diff --git a/npm/ng-packs/scripts/build.js b/npm/ng-packs/scripts/build.js new file mode 100644 index 0000000000..e2fa882625 --- /dev/null +++ b/npm/ng-packs/scripts/build.js @@ -0,0 +1 @@ +import execa from 'execa'; diff --git a/npm/ng-packs/scripts/index.js b/npm/ng-packs/scripts/index.js new file mode 100644 index 0000000000..a82d62f972 --- /dev/null +++ b/npm/ng-packs/scripts/index.js @@ -0,0 +1,4 @@ +// Set options as a parameter, environment variable, or rc file. +// eslint-disable-next-line no-global-assign +require = require('esm')(module /* , options */); +module.exports = require('./main.js'); diff --git a/npm/ng-packs/scripts/package.json b/npm/ng-packs/scripts/package.json new file mode 100644 index 0000000000..a69ea2101d --- /dev/null +++ b/npm/ng-packs/scripts/package.json @@ -0,0 +1,20 @@ +{ + "name": "scripts", + "version": "1.0.0", + "description": "Abp publish helper scripts", + "main": "index.js", + "modules": "[build.js, sync.js]", + "scripts": { + "build": "node -r esm build.js", + "sync": "node -r esm sync.js", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "babel-preset-node6": "^11.0.0", + "esm": "^3.2.25", + "execa": "^2.0.3", + "fs-extra": "^8.1.0" + } +} diff --git a/npm/ng-packs/scripts/sync.js b/npm/ng-packs/scripts/sync.js new file mode 100644 index 0000000000..366057bf8e --- /dev/null +++ b/npm/ng-packs/scripts/sync.js @@ -0,0 +1,24 @@ +// ESM syntax is supported. +import execa from 'execa'; +import fse from 'fs-extra'; + +(async () => { + const { projects } = await fse.readJSON('../angular.json'); + const projectNames = Object.keys(projects); + + projectNames.forEach(async project => { + const { dependencies: distDependencies, version } = await fse.readJSON(`../dist/${project}/package.json`); + const srcPackagePath = `../packages/${project}/package.json`; + const srcPackage = await fse.readJSON(srcPackagePath); + + if (distDependencies) { + for (const key in srcPackage.dependencies) { + if (distDependencies.hasOwnProperty(key)) { + srcPackage.dependencies[key] = distDependencies[key]; + } + } + } + + await fse.writeJSON(srcPackagePath, { ...srcPackage, version }, { spaces: 2 }); + }); +})();