Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROOT_URL not getting replaced in module-unification app #130

Closed
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.hbs]
insert_final_newline = false

[*.{diff,md}]
trim_trailing_whitespace = false
9 changes: 9 additions & 0 deletions .ember-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
}
26 changes: 18 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/dist/
/tmp/

# dependencies
/node_modules
/bower_components
/bower_components/
/node_modules/

# misc
/.sass-cache
/connect.lock
/coverage/*
/coverage/
/libpeerconnection.log
npm-debug.log*
yarn-error.log*
yarn.lock
package-lock.json
testem.log
/node-tests/fixtures/ember-service-worker.tgz
/node-tests/fixtures/simple-app/ember-service-worker.tgz
/node-tests/fixtures/simple-app/package-lock.json
/node-tests/fixtures/tmp/*

/node-tests/fixtures/mu-app/ember-service-worker.tgz
/node-tests/fixtures/mu-app/package-lock.json
/node-tests/fixtures/tmp/*

# jekyll docs
/docs/_site
/npm-debug.log*
/testem.log
yarn-error.log

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
45 changes: 27 additions & 18 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
/bower_components

# compiled output
/dist/
/tmp/
/node-tests

# dependencies
/bower_components/

# misc
/.bowerrc
/.editorconfig
/.ember-cli
/.eslintignore
/.eslintrc.js
/.gitignore
/.watchmanconfig
/.travis.yml
/bower.json
/config/ember-try.js
/dist
/tests
/tmp
**/.gitkeep
.bowerrc
.editorconfig
.ember-cli
.eslintrc.js
.gitignore
.watchmanconfig
.travis.yml
bower.json
ember-cli-build.js
testem.js
/ember-cli-build.js
/testem.js
/tests/
/yarn.lock
.gitkeep

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
5 changes: 5 additions & 0 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
extends: 'recommended'
};
39 changes: 29 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
language: node_js
node_js:
# we recommend testing addons with the same minimum supported node version as Ember CLI
# so that your addon works for all apps
- "6"
- "8"
- "stable"

sudo: false

Expand All @@ -12,22 +12,41 @@ cache:
- $HOME/.npm
- node_modules
- node-tests/fixtures/simple-app/node_modules
- node-tests/fixtures/mu-app/node_modules

env:
- TEST_SCENARIO=test
- TEST_SCENARIO=fastboottest

matrix:
fast_finish: true
jobs:
fail_fast: true
allow_failures:
- env: EMBER_TRY_SCENARIO=ember-canary

include:
# runs linting and tests with current locked deps

- stage: "Tests"
name: "Tests"
script:
# - npm run lint:hbs
# - npm run lint:js
- npm test $TEST_SCENARIO
env: TEST_SCENARIO=test
- env: TEST_SCENARIO=fastboottest

# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
# - stage: "Additional Tests"
# env: EMBER_TRY_SCENARIO=ember-lts-2.16
# - env: EMBER_TRY_SCENARIO=ember-lts-2.18
# - env: EMBER_TRY_SCENARIO=ember-release
# - env: EMBER_TRY_SCENARIO=ember-beta
# - env: EMBER_TRY_SCENARIO=ember-canary
# - env: EMBER_TRY_SCENARIO=ember-default-with-jquery

before_install:
- npm install -g npm@4
- npm --version

install:
- npm install

script:
- npm run $TEST_SCENARIO
# script:
# - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO
3 changes: 3 additions & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignore_dirs": ["tmp", "dist"]
}
84 changes: 84 additions & 0 deletions config/ember-try.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
'use strict';

const getChannelURL = require('ember-source-channel-url');

module.exports = function() {
return Promise.all([
getChannelURL('release'),
getChannelURL('beta'),
getChannelURL('canary')
]).then((urls) => {
return {
useYarn: true,
scenarios: [
{
name: 'ember-lts-2.16',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({ 'jquery-integration': true }),
},
npm: {
devDependencies: {
'@ember/jquery': '^0.5.1',
'ember-source': '~2.16.0'
}
}
},
{
name: 'ember-lts-2.18',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({ 'jquery-integration': true }),
},
npm: {
devDependencies: {
'@ember/jquery': '^0.5.1',
'ember-source': '~2.18.0'
}
}
},
{
name: 'ember-release',
npm: {
devDependencies: {
'ember-source': urls[0]
}
}
},
{
name: 'ember-beta',
npm: {
devDependencies: {
'ember-source': urls[1]
}
}
},
{
name: 'ember-canary',
npm: {
devDependencies: {
'ember-source': urls[2]
}
}
},
{
name: 'ember-default',
npm: {
devDependencies: {}
}
},
{
name: 'ember-default-with-jquery',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({
'jquery-integration': true
})
},
npm: {
devDependencies: {
'@ember/jquery': '^0.5.1'
}
}
}
]
};
});
};
5 changes: 5 additions & 0 deletions config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = function(/* environment, appConfig */) {
return { };
};
23 changes: 23 additions & 0 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
let app = new EmberAddon(defaults, {
hinting: false,
// Add options here
'ember-cli-babel': {
// Used by the dummy app, doesn't affect the host app
includePolyfill: true
}
});

/*
This build file specifies the options for the dummy test app of this
addon, located in
This build file does *not* influence how the addon or the app using it
behave. You most likely want to be modifying or app's build file
*/

return app.toTree();
};
16 changes: 10 additions & 6 deletions lib/rollup-with-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const Rollup = require('broccoli-rollup');
const path = require('path');
const existsSync = require('exists-sync');
const { existsSync } = require('fs');

module.exports = class RollupWithDependencies extends Rollup {
/*
Expand All @@ -12,11 +12,11 @@ module.exports = class RollupWithDependencies extends Rollup {
So given:

```
input/
service-a/
index.js
other.js
service-b.js
- input/
- service-a/
- index.js
- other.js
- service-b.js
```

We would resolve the following:
Expand All @@ -31,13 +31,17 @@ module.exports = class RollupWithDependencies extends Rollup {

plugins.push({
resolveId(importee, importer) {
debugger; // if you've hit this, you've gone too far

let modulePath = path.join(inputPath, `${importee}.js`);

if (existsSync(modulePath)) {
return modulePath;
}

// allow service-worker/addon-name/index.js fallback
modulePath = path.join(inputPath, importee, 'index.js');

if (existsSync(modulePath)) {
return modulePath;
}
Expand Down
12 changes: 8 additions & 4 deletions lib/service-worker-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,22 @@ module.exports = class ServiceWorkerBuilder {
ROOT_URL: this.options.rootURL
};

return new Rollup(tree, {
let rollupTree = new Rollup(tree, {
inputFiles: '**/*.js',
rollup: {
entry: entryFile,
dest: destFile || entryFile,
format: 'iife',
exports: 'none',
output: {
file: destFile || entryFile,
format: 'iife',
exports: 'none',
},
plugins: [
rollupReplace(rollupReplaceConfig)
]
}
});

return rollupTree;
}

_uglifyTree(tree) {
Expand Down
Loading