Skip to content

Commit

Permalink
Convert to V2 addon (#411)
Browse files Browse the repository at this point in the history
* Convert to V2 addon

* Add ci working directory

* Add `ember/test-helpers` dep
  • Loading branch information
herzzanu authored May 11, 2023
1 parent 9c0c39e commit 4d679a2
Show file tree
Hide file tree
Showing 76 changed files with 1,796 additions and 1,490 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- 'v*'
pull_request: {}

concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
NODE_VERSION: 16

Expand Down Expand Up @@ -47,6 +51,7 @@ jobs:
run: yarn install --frozen-lockfile
- name: Run Tests
run: yarn test:ember
working-directory: test-app

try-scenarios:
name: ${{ matrix.try-scenario }}
Expand All @@ -63,7 +68,6 @@ jobs:
- ember-release
- ember-beta
- ember-canary
- ember-classic
- embroider-safe
- embroider-optimized

Expand All @@ -77,4 +81,5 @@ jobs:
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Run Tests
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }}
run: yarn ember try:one ${{ matrix.try-scenario }}
working-directory: test-app
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"endOfLine":"auto",
"endOfLine": "auto",
"singleQuote": true,
"overrides": [
{
Expand Down
1 change: 0 additions & 1 deletion app/helpers/variation.js

This file was deleted.

25 changes: 0 additions & 25 deletions ember-cli-build.js

This file was deleted.

8 changes: 8 additions & 0 deletions ember-launch-darkly/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# unconventional js
/blueprints/*/files/

# compiled output
/dist/

# misc
/coverage/
42 changes: 42 additions & 0 deletions ember-launch-darkly/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
'use strict';

module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
plugins: ['ember'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
env: {
browser: true,
},
rules: {},
overrides: [
// node files
{
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.template-lintrc.js',
'./addon-main.js',
],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
},
extends: ['plugin:n/recommended'],
},
],
};
31 changes: 31 additions & 0 deletions ember-launch-darkly/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
dist/

# dependencies
node_modules/

# misc
/.env*
/.pnp*
/.pnpm-debug.log
/.sass-cache
.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/package.json.ember-try
/yarn.lock.ember-try

# The authoritative copies of these live in the monorepo root (because they're
# more useful on github that way), but the build copies them into here so they
# will also appear in published NPM packages.
/README.md
/LICENSE.md
File renamed without changes.
4 changes: 4 additions & 0 deletions ember-launch-darkly/addon-main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict';

const { addonV1Shim } = require('@embroider/addon-shim');
module.exports = addonV1Shim(__dirname);
7 changes: 7 additions & 0 deletions ember-launch-darkly/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties",
"@embroider/addon-dev/template-colocation-plugin"
]
}
83 changes: 83 additions & 0 deletions ember-launch-darkly/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"name": "ember-launch-darkly",
"version": "3.0.0",
"description": "A modern Ember addon to wrap the Launch Darkly service",
"keywords": [
"ember-addon"
],
"repository": "https://github.com/adopted-ember-addons/ember-launch-darkly",
"license": "MIT",
"author": "The Ember Launch Darkly Team",
"directories": {
"doc": "doc",
"test": "tests"
},
"files": [
"addon-main.js",
"dist"
],
"scripts": {
"build": "rollup --config",
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
"lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
"lint:js": "eslint . --cache",
"lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
"lint:js:fix": "eslint . --fix",
"start": "rollup --config --watch",
"test": "echo 'A v2 addon does not have tests, run tests in test-app'",
"prepack": "rollup --config"
},
"dependencies": {
"@ember/test-helpers": "^2.9.3",
"@embroider/addon-shim": "^1.0.0",
"ember-window-mock": "^0.8.1",
"launchdarkly-js-client-sdk": "^3.1.1",
"tracked-maps-and-sets": "^3.0.2"
},
"devDependencies": {
"@babel/core": "^7.21.3",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.21.0",
"@embroider/addon-dev": "^3.0.0",
"@rollup/plugin-babel": "^6.0.3",
"babel-eslint": "^10.1.0",
"concurrently": "^7.6.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-ember": "^11.4.7",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-qunit": "^7.3.4",
"prettier": "^2.8.4",
"rollup": "^3.19.1",
"rollup-plugin-copy": "3.4.0"
},
"peerDependencies": {
"ember-source": "^3.28.0 || ^4.0.0"
},
"ember": {
"edition": "octane"
},
"ember-addon": {
"version": 2,
"type": "addon",
"main": "addon-main.js",
"app-js": {
"./helpers/variation.js": "./dist/_app_/helpers/variation.js"
}
},
"exports": {
".": "./dist/index.js",
"./*": {
"default": "./dist/*.js"
},
"./test-support": "./dist/test-support/index.js",
"./-sdk": "./dist/-sdk/index.js",
"./-sdk/context": "./dist/-sdk/context.js",
"./-sdk/identify": "./dist/-sdk/identify.js",
"./-sdk/initialize": "./dist/-sdk/initialize.js",
"./-sdk/variation": "./dist/-sdk/variation.js",
"./addon-main.js": "./addon-main.js"
}
}
51 changes: 51 additions & 0 deletions ember-launch-darkly/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import babel from '@rollup/plugin-babel';
import copy from 'rollup-plugin-copy';
import { Addon } from '@embroider/addon-dev/rollup';

const addon = new Addon({
srcDir: 'src',
destDir: 'dist',
});

export default {
// This provides defaults that work well alongside `publicEntrypoints` below.
// You can augment this if you need to.
output: addon.output(),

plugins: [
// These are the modules that users should be able to import from your
// addon. Anything not listed here may get optimized away.
addon.publicEntrypoints(['**/*.js']),

// These are the modules that should get reexported into the traditional
// "app" tree. Things in here should also be in publicEntrypoints above, but
// not everything in publicEntrypoints necessarily needs to go here.
addon.appReexports(['helpers/**/*.js']),

// This babel config should *not* apply presets or compile away ES modules.
// It exists only to provide development niceties for you, like automatic
// template colocation.
//
// By default, this will load the actual babel config from the file
// babel.config.json.
babel({
babelHelpers: 'bundled',
}),

// Follow the V2 Addon rules about dependencies. Your code can import from
// `dependencies` and `peerDependencies` as well as standard Ember-provided
// package names.
addon.dependencies(),

// Remove leftover build artifacts when starting a new build.
addon.clean(),

// Copy Readme and License into published package
copy({
targets: [
{ src: '../README.md', dest: '.' },
{ src: '../LICENSE.md', dest: '.' },
],
}),
],
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 4d679a2

Please sign in to comment.