Skip to content

Commit

Permalink
Readd themes & fixes for export
Browse files Browse the repository at this point in the history
  • Loading branch information
mkszepp committed Dec 19, 2023
1 parent 9ed6b76 commit 0ce9889
Show file tree
Hide file tree
Showing 22 changed files with 1,114 additions and 147 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"eslint.validate": [
"glimmer-ts",
"glimmer-js"
]
}
1 change: 1 addition & 0 deletions ember-power-select/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# compiled output
/dist
/declarations
/vendor

# npm/pnpm/yarn pack output
*.tgz
6 changes: 3 additions & 3 deletions ember-power-select/_index.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import 'less/variables';
@import './less/variables';

@import '~ember-basic-dropdown/app/styles/ember-basic-dropdown';
@import 'ember-basic-dropdown/app/styles/ember-basic-dropdown';

@import 'less/base';
@import './less/base';
6 changes: 3 additions & 3 deletions ember-power-select/_index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import 'scss/variables';
@import './scss/variables';

@import '~ember-basic-dropdown/app/styles/ember-basic-dropdown';
@import 'ember-basic-dropdown/app/styles/ember-basic-dropdown';

@import 'scss/base';
@import './scss/base';
File renamed without changes.
File renamed without changes.
25 changes: 22 additions & 3 deletions ember-power-select/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,18 @@
"types": "./declarations/*.d.ts",
"default": "./dist/*.js"
},
"./addon-main.js": "./addon-main.cjs"
"./addon-main.js": "./addon-main.cjs",
"./_index.less": "./_index.less",
"./_index.scss": "./_index.scss",
"./less/base.less": "./less/base.less",
"./scss/base.scss": "./scss/base.scss",
"./less/variables.less": "./less/variables.less",
"./scss/variables.scss": "./scss/variables.scss",
"./themes/bootstrap.less": "./less/themes/bootstrap.less",
"./themes/bootstrap.scss": "./scss/themes/bootstrap.scss",
"./themes/material.less": "./less/themes/material.less",
"./themes/material.scss": "./scss/themes/material.scss",
"./vendor/*": "./vendor/*"
},
"typesVersions": {
"*": {
Expand All @@ -33,9 +44,14 @@
}
},
"files": [
"_index.scss",
"_index.less",
"addon-main.cjs",
"declarations",
"dist"
"dist",
"less",
"scss",
"vendor"
],
"scripts": {
"build": "concurrently 'npm:build:*'",
Expand Down Expand Up @@ -114,10 +130,13 @@
"eslint-plugin-ember": "^11.11.1",
"eslint-plugin-n": "^16.0.0",
"eslint-plugin-prettier": "^5.0.0",
"node-sass": "^9.0.0",
"postcss": "^8.4.32",
"prettier": "^3.0.3",
"prettier-plugin-ember-template-tag": "^1.1.0",
"rollup": "^3.21.8",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-styles": "^4.0.0",
"sass": "^1.69.5",
"typescript": "^5.0.4"
},
"peerDependencies": {
Expand Down
181 changes: 97 additions & 84 deletions ember-power-select/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,100 +1,113 @@
import { babel } from '@rollup/plugin-babel';
import copy from 'rollup-plugin-copy';
import { Addon } from '@embroider/addon-dev/rollup';
import styles from 'rollup-plugin-styles';
import path from 'path';

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.
// By default all your JavaScript modules (**/*.js) will be importable.
// But you are encouraged to tweak this to only cover the modules that make
// up your addon's public API. Also make sure your package.json#exports
// is aligned to the config here.
// See https://github.com/embroider-build/embroider/blob/main/docs/v2-faq.md#how-can-i-define-the-public-exports-of-my-addon
addon.publicEntrypoints(["index.js", "**/*.js"]),
export default [
// Compile scss file for js import
{
input: './_index.scss',
output: {
file: './vendor/ember-power-select.js',
assetFileNames: '[name][extname]',
},
plugins: [
styles({
mode: ['extract', 'ember-power-select.css'],
sass: {
includePaths: [path.resolve('node_modules')],
},
}),
],
},
{
input: './scss/bootstrap-complete.scss',
output: {
file: './vendor/ember-power-select-bootstrap.js',
assetFileNames: '[name][extname]',
},
plugins: [
styles({
mode: ['extract', 'ember-power-select-bootstrap.css'],
sass: {
includePaths: [path.resolve('node_modules')],
},
}),
],
},
{
input: './scss/material-complete.scss',
output: {
file: './vendor/ember-power-select-material.js',
assetFileNames: '[name][extname]',
},
plugins: [
styles({
mode: ['extract', 'ember-power-select-material.css'],
sass: {
includePaths: [path.resolve('node_modules')],
},
}),
],
},
{
// This provides defaults that work well alongside `publicEntrypoints` below.
// You can augment this if you need to.
output: addon.output(),

// 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([
'components/**/*.js',
'helpers/**/*.js',
'test-support/*.js',
'utils/*.js',
]),
plugins: [
// These are the modules that users should be able to import from your
// addon. Anything not listed here may get optimized away.
// By default all your JavaScript modules (**/*.js) will be importable.
// But you are encouraged to tweak this to only cover the modules that make
// up your addon's public API. Also make sure your package.json#exports
// is aligned to the config here.
// See https://github.com/embroider-build/embroider/blob/main/docs/v2-faq.md#how-can-i-define-the-public-exports-of-my-addon
addon.publicEntrypoints(['index.js', '**/*.js']),

// 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(),
// 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([
'components/**/*.js',
'helpers/**/*.js',
'test-support/*.js',
'utils/*.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({
extensions: ['.js', '.gjs', '.ts', '.gts'],
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(),

// Ensure that standalone .hbs files are properly integrated as Javascript.
addon.hbs(),
// 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({
extensions: ['.js', '.gjs', '.ts', '.gts'],
babelHelpers: 'bundled',
}),

// Ensure that .gjs files are properly integrated as Javascript
addon.gjs(),
// Ensure that standalone .hbs files are properly integrated as Javascript.
addon.hbs(),

// addons are allowed to contain imports of .css files, which we want rollup
// to leave alone and keep in the published output.
addon.keepAssets(['**/*.css']),
// Ensure that .gjs files are properly integrated as Javascript
addon.gjs(),

// Remove leftover build artifacts when starting a new build.
addon.clean(),
// addons are allowed to contain imports of .css files, which we want rollup
// to leave alone and keep in the published output.
addon.keepAssets(['**/*.css']),

// Copy SCSS / LESS into published package
copy({
targets: [
{
src: 'src/css/ember-power-select.scss',
dest: '.',
rename: '_index.scss',
},
{
src: 'src/css/ember-power-select.less',
dest: '.',
rename: '_index.less',
},
{
src: 'src/css/ember-power-select/variables.scss',
dest: 'scss',
rename: 'variables.scss',
},
{
src: 'src/css/ember-power-select/variables.less',
dest: 'less',
rename: 'variables.less',
},
{
src: 'src/css/ember-power-select/base.scss',
dest: 'scss',
rename: 'base.scss',
},
{
src: 'src/css/ember-power-select/base.less',
dest: 'less',
rename: 'base.less',
},
],
}),
],
};
// Remove leftover build artifacts when starting a new build.
addon.clean(),
],
},
];
File renamed without changes.
2 changes: 2 additions & 0 deletions ember-power-select/scss/bootstrap-complete.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import './themes/bootstrap';
@import '../_index.scss';
2 changes: 2 additions & 0 deletions ember-power-select/scss/material-complete.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import './themes/material';
@import '../_index.scss';
File renamed without changes.
5 changes: 0 additions & 5 deletions ember-power-select/src/css/ember-power-select.less

This file was deleted.

5 changes: 0 additions & 5 deletions ember-power-select/src/css/ember-power-select.scss

This file was deleted.

1 change: 1 addition & 0 deletions ember-power-select/src/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../vendor/ember-power-select.css';
1 change: 1 addition & 0 deletions ember-power-select/src/themes/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../vendor/ember-power-select-bootstrap.css';
1 change: 1 addition & 0 deletions ember-power-select/src/themes/material.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../../vendor/ember-power-select-material.css';
Loading

0 comments on commit 0ce9889

Please sign in to comment.