From 5bf949bd9d829bbf82c844b13d0cd5baca92f687 Mon Sep 17 00:00:00 2001 From: Chris Garrett Date: Tue, 24 Mar 2020 14:27:03 -0700 Subject: [PATCH] [CHORE] Fixes local linking --- .eslintrc.js | 2 +- lib/local-linker/index.js | 25 +++++++++++++++ lib/local-linker/package.json | 10 ++++++ package.json | 9 +++++- packages/@glimmer/compiler/package.json | 3 ++ .../@glimmer/opcode-compiler/package.json | 1 + packages/@glimmer/program/package.json | 3 ++ yarn.lock | 31 ++++++++++++++++++- 8 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 lib/local-linker/index.js create mode 100644 lib/local-linker/package.json diff --git a/.eslintrc.js b/.eslintrc.js index d44f84bfb6..f72b1543c0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,7 +17,7 @@ module.exports = { settings: { node: { allowModules: ['@glimmer/debug', '@glimmer/local-debug-flags'], - tryExtensions: ['.js', '.ts', '.d.ts'], + tryExtensions: ['.js', '.ts', '.d.ts', '.json'], }, }, ignorePatterns: ['dist', 'ts-dist', 'node_modules', 'tmp'], diff --git a/lib/local-linker/index.js b/lib/local-linker/index.js new file mode 100644 index 0000000000..6a62fbad7c --- /dev/null +++ b/lib/local-linker/index.js @@ -0,0 +1,25 @@ +'use strict'; + +let fs = require('fs-extra'); +let symlinkOrCopy = require('symlink-or-copy').sync; + +let dir = `${__dirname}/../../dist`; + +module.exports = { + name: require('./package').name, + + isDevelopingAddon() { + return true; + }, + + preBuild() { + fs.removeSync(`${dir}/node_modules`); + }, + + outputReady() { + fs.mkdirsSync(`${dir}/@glimmer`); + fs.mkdirsSync(`${dir}/node_modules`); + + symlinkOrCopy(`${dir}/@glimmer`, `${dir}/node_modules/@glimmer`); + }, +}; diff --git a/lib/local-linker/package.json b/lib/local-linker/package.json new file mode 100644 index 0000000000..82e1380f1f --- /dev/null +++ b/lib/local-linker/package.json @@ -0,0 +1,10 @@ +{ + "name": "local-linker", + "keywords": [ + "ember-addon" + ], + "dependencies": { + "fs-extra": "*", + "symlink-or-copy": "*" + } +} diff --git a/package.json b/package.json index 7a0e7aea7e..78c09a2eca 100644 --- a/package.json +++ b/package.json @@ -37,8 +37,10 @@ "@simple-dom/serializer": "^1.4.0", "@simple-dom/void-map": "^1.4.0", "babel-plugin-debug-macros": "^0.3.3", + "fs-extra": "^9.0.0", "handlebars": "^4.5.1", - "simple-html-tokenizer": "^0.5.9" + "simple-html-tokenizer": "^0.5.9", + "symlink-or-copy": "^1.3.1" }, "devDependencies": { "@babel/core": "^7.8.4", @@ -141,5 +143,10 @@ "volta": { "node": "10.16.3", "yarn": "1.17.3" + }, + "ember-addon": { + "paths": [ + "lib/local-linker" + ] } } diff --git a/packages/@glimmer/compiler/package.json b/packages/@glimmer/compiler/package.json index 291ca47e6c..fde298c7ee 100644 --- a/packages/@glimmer/compiler/package.json +++ b/packages/@glimmer/compiler/package.json @@ -8,5 +8,8 @@ "@glimmer/wire-format": "^0.50.0", "@glimmer/interfaces": "^0.50.0", "@simple-dom/interface": "^1.4.0" + }, + "devDependencies": { + "@glimmer/local-debug-flags": "^0.50.0" } } diff --git a/packages/@glimmer/opcode-compiler/package.json b/packages/@glimmer/opcode-compiler/package.json index 6dc9847dfc..4b9d7dc14b 100644 --- a/packages/@glimmer/opcode-compiler/package.json +++ b/packages/@glimmer/opcode-compiler/package.json @@ -12,6 +12,7 @@ "@glimmer/reference": "^0.50.0" }, "devDependencies": { + "@glimmer/debug": "^0.50.0", "@glimmer/local-debug-flags": "^0.50.0" } } diff --git a/packages/@glimmer/program/package.json b/packages/@glimmer/program/package.json index d5285aa1b8..3bdd27637a 100644 --- a/packages/@glimmer/program/package.json +++ b/packages/@glimmer/program/package.json @@ -6,5 +6,8 @@ "@glimmer/util": "^0.50.0", "@glimmer/interfaces": "^0.50.0", "@glimmer/encoder": "^0.50.0" + }, + "devDependencies": { + "@glimmer/local-debug-flags": "^0.50.0" } } diff --git a/yarn.lock b/yarn.lock index a177a10193..67634adabd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1366,6 +1366,11 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= +at-least-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" + integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== + atob@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" @@ -3847,6 +3852,16 @@ fs-extra@^8.0.1, fs-extra@^8.1.0: jsonfile "^4.0.0" universalify "^0.1.0" +fs-extra@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.0.tgz#b6afc31036e247b2466dc99c29ae797d5d4580a3" + integrity sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^1.0.0" + fs-merger@^3.0.1: version "3.0.2" resolved "https://registry.yarnpkg.com/fs-merger/-/fs-merger-3.0.2.tgz#bf111334b89b8d65b95580d33c587dc79620a4e3" @@ -5066,6 +5081,15 @@ jsonfile@^4.0.0: optionalDependencies: graceful-fs "^4.1.6" +jsonfile@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.0.1.tgz#98966cba214378c8c84b82e085907b40bf614179" + integrity sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg== + dependencies: + universalify "^1.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" @@ -7827,7 +7851,7 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -symlink-or-copy@^1.0.0, symlink-or-copy@^1.0.1, symlink-or-copy@^1.1.8, symlink-or-copy@^1.2.0, symlink-or-copy@^1.3.0: +symlink-or-copy@^1.0.0, symlink-or-copy@^1.0.1, symlink-or-copy@^1.1.8, symlink-or-copy@^1.2.0, symlink-or-copy@^1.3.0, symlink-or-copy@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/symlink-or-copy/-/symlink-or-copy-1.3.1.tgz#9506dd64d8e98fa21dcbf4018d1eab23e77f71fe" integrity sha512-0K91MEXFpBUaywiwSSkmKjnGcasG/rVBXFLJz5DrgGabpYD6N+3yZrfD6uUIfpuTu65DZLHi7N8CizHc07BPZA== @@ -8286,6 +8310,11 @@ universalify@^0.1.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== +universalify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d" + integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug== + unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"