Skip to content

Commit

Permalink
[FEAT] Makes package usable as a normal NPM package
Browse files Browse the repository at this point in the history
Updates the package setup to make it usable as a normal NPM package.
TypeScript is compiled before release, `main` and `module` are set to
the proper file paths, and ec-typescript has been removed.
  • Loading branch information
Chris Garrett committed May 19, 2020
1 parent d656281 commit 57646dc
Show file tree
Hide file tree
Showing 11 changed files with 201 additions and 184 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
/vendor/

# compiled output
/addon/
/dist/
/tmp/
/commonjs/

# dependencies
/bower_components/
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = {
'.eslintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'index.js',
'ember-addon-main.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/addon/
/dist/
/tmp/
/commonjs/

# dependencies
/bower_components/
Expand Down
File renamed without changes.
24 changes: 15 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,34 @@
],
"repository": "https://github.com/pzuraq/tracked-maps-and-sets",
"license": "MIT",
"author": "Chris Hewell Garrettg",
"author": "Chris Hewell Garrett",
"main": "commonjs/index.js",
"module": "addon/index.js",
"files": [
"addon/**/*",
"ember-addon-main.js"
],
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build:ts": "tsc && tsc --outDir commonjs --module CommonJS",
"build": "ember build --environment=production",
"lint:hbs": "ember-template-lint .",
"lint:js": "eslint .",
"start": "ember serve",
"test": "ember test",
"test": "yarn build:ts && ember test",
"test:all": "ember try:each",
"prepublishOnly": "ember ts:precompile",
"postpublish": "ember ts:clean"
"prepublish": "yarn build:ts"
},
"dependencies": {
"ember-cli-babel": "^7.17.2",
"ember-cli-typescript": "^3.1.3"
"@glimmer/tracking": "^1.0.0",
"ember-cli-babel": "^7.17.2"
},
"devDependencies": {
"@ember/optional-features": "^1.3.0",
"@glimmer/component": "^1.0.0",
"@glimmer/tracking": "^1.0.0",
"@types/ember": "^3.1.1",
"@types/ember-qunit": "^3.4.7",
"@types/ember__test-helpers": "^0.7.9",
Expand All @@ -41,7 +46,6 @@
"ember-auto-import": "^1.5.3",
"ember-cli": "~3.16.1",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-eslint": "^5.1.0",
"ember-cli-htmlbars": "^4.2.2",
"ember-cli-inject-live-reload": "^2.0.2",
"ember-cli-sri": "^2.1.1",
Expand All @@ -58,6 +62,7 @@
"ember-source-channel-url": "^2.0.1",
"ember-try": "^1.4.0",
"ember-welcome-page": "^4.0.0",
"eslint": "^7.0.0",
"eslint-plugin-ember": "^7.7.2",
"eslint-plugin-node": "^11.0.0",
"loader.js": "^4.7.0",
Expand All @@ -73,7 +78,8 @@
"edition": "octane"
},
"ember-addon": {
"configPath": "tests/dummy/config"
"configPath": "tests/dummy/config",
"main": "ember-addon-main.js"
},
"release-it": {
"plugins": {
Expand Down
File renamed without changes.
File renamed without changes.
22 changes: 16 additions & 6 deletions addon/-private/util.ts → src/-private/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { tracked } from '@glimmer/tracking';
import { get, notifyPropertyChange } from '@ember/object';

class Tag {
@tracked private __tag_value__: undefined;
Expand All @@ -24,12 +23,23 @@ export const dirtyTag = Tag.dirtyTag;

////////////

export function consumeCollection(obj: object) {
get(obj as { '[]': unknown }, '[]');
}
const COLLECTION_SYMBOL = {};

export let consumeCollection = (obj: object): void => {
consumeKey(obj, COLLECTION_SYMBOL);
};

export let dirtyCollection = (obj: object): void => {
dirtyKey(obj, COLLECTION_SYMBOL);
};

declare const Ember: any;

export function dirtyCollection(obj: object) {
notifyPropertyChange(obj, '[]')
if (Ember !== undefined) {
// eslint-disable-next-line ember/new-module-imports
consumeCollection = (obj): void => Ember.get(obj, '[]');
// eslint-disable-next-line ember/new-module-imports
dirtyCollection = (obj): void => Ember.notifyPropertyChange(obj, '[]');
}

////////////
Expand Down
File renamed without changes.
38 changes: 4 additions & 34 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"target": "es2017",
"target": "es2015",
"module": "es2015",
"allowJs": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
Expand All @@ -14,43 +15,12 @@
"noUnusedParameters": true,
"noImplicitReturns": true,
"noEmitOnError": false,
"noEmit": true,
"inlineSourceMap": true,
"inlineSources": true,
"baseUrl": ".",
"module": "es6",
"experimentalDecorators": true,
"paths": {
"dummy/tests/*": [
"tests/*"
],
"dummy/*": [
"tests/dummy/app/*",
"app/*"
],
"tracked-maps-and-sets": [
"addon"
],
"tracked-maps-and-sets/*": [
"addon/*"
],
"tracked-maps-and-sets/test-support": [
"addon-test-support"
],
"tracked-maps-and-sets/test-support/*": [
"addon-test-support/*"
],
"*": [
"types/*"
]
}
"outDir": "addon"
},
"include": [
"app/**/*",
"addon/**/*",
"tests/**/*",
"types/**/*",
"test-support/**/*",
"addon-test-support/**/*"
"src/**/*"
]
}
Loading

0 comments on commit 57646dc

Please sign in to comment.