@citolab/tspci 2.0.7 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/release-notes.md CHANGED
@@ -1,14 +1,18 @@
1
- ## 2.0.0
2
-
3
- - added customized development templates in plugins
4
- - removed tooltips development environment pci
5
- - fixed storing and comparing responses
6
- - fixed reload test and restoring state
7
-
8
- ## 1.5.8
9
-
10
- - fixed command line args --target not picked up by cli
11
-
12
- ## 1.5.7
13
-
1
+ ## 2.0.0
2
+
3
+ - added customized development templates in plugins
4
+ - removed tooltips development environment pci
5
+ - fixed storing and comparing responses
6
+ - fixed reload test and restoring state
7
+
8
+ # 1.5.9
9
+
10
+ - fixed broken images in readme
11
+
12
+ ## 1.5.8
13
+
14
+ - fixed command line args --target not picked up by cli
15
+
16
+ ## 1.5.7
17
+
14
18
  Initial release
package/src/cli.js CHANGED
@@ -1,143 +1,143 @@
1
- #!/usr/bin/env node
2
- import loadConfigFile from "rollup/dist/loadConfigFile.js";
3
- import { rollup, watch } from "rollup";
4
- import path from "path";
5
- import fs from "fs";
6
-
7
- const args = process.argv.slice(2);
8
-
9
- // PK: retreive dirname, most of the time automaticly inserted in es modules
10
- import { fileURLToPath } from "url";
11
- const __filename = fileURLToPath(import.meta.url);
12
- const __dirname = path.dirname(__filename);
13
-
14
- const PACKAGE_ROOT_PATH = process.cwd();
15
- const PACKAGE_DIST_PATH = path.join(PACKAGE_ROOT_PATH, "dist");
16
- const NODE_MODULES = path.join(process.cwd(), "node_modules");
17
-
18
- // https://rollupjs.org/guide/en/#programmatically-loading-a-config-file
19
- const watchBuild = (devServer = false, target = 'IMS') => {
20
- const rollupFile = devServer ? "rollup.config.dev.js" : "rollup.config.js";
21
-
22
- fs.rmSync(PACKAGE_DIST_PATH, { recursive: true, force: true });
23
- !fs.existsSync(PACKAGE_DIST_PATH) && fs.mkdirSync(PACKAGE_DIST_PATH);
24
-
25
- if (devServer) {
26
- try {
27
- if (fs.existsSync(path.join(PACKAGE_ROOT_PATH, "src/index.html"))) {
28
- fs.copyFile(
29
- path.join(PACKAGE_ROOT_PATH, "src/index.html"),
30
- path.join(PACKAGE_DIST_PATH, "index.html"),
31
- (err) => {
32
- if (err) throw err;
33
- console.log("using index.html found in src/index.html, copied to dist");
34
- }
35
- );
36
- } else {
37
- let fileToCopy;
38
- if (target == 'IMS') {
39
- fileToCopy = path.join(__dirname, `../public/index.html`)
40
- } else {
41
- fileToCopy = path.join(NODE_MODULES, `@citolab/tspci-${target}/public/index.html`);
42
- }
43
- fs.copyFile(fileToCopy, path.join(PACKAGE_DIST_PATH, "index.html"), (err) => {
44
- if (err) throw err;
45
- console.log("using index.html was copied to /dist folder pci");
46
- });
47
- }
48
- } catch (err) {
49
- console.error(err);
50
- }
51
- }
52
- loadConfigFile(path.resolve(__dirname, rollupFile), {}).then(async ({ options, warnings }) => {
53
- console.log(`We currently have ${warnings.count} warnings`);
54
- warnings.flush();
55
- const watcher = watch(options);
56
- watcher.on("event", (event) => {
57
- event.code == "START" && console.log("starting build");
58
- event.code == "ERROR" && console.log("ERROR", event);
59
- });
60
- watcher.on("event", ({ result }) => {
61
- if (result) {
62
- result.close();
63
- }
64
- });
65
- watcher.close();
66
- });
67
- };
68
-
69
- const prodBuild = async () => {
70
- fs.rmSync(path.join(PACKAGE_ROOT_PATH, "dist"), { recursive: true, force: true });
71
- return loadConfigFile(path.resolve(__dirname, "rollup.config.prod.js"), {}).then(async ({ options, warnings }) => {
72
- console.log(`We currently have ${warnings.count} warnings`);
73
- warnings.flush();
74
- for (const optionsObj of options) {
75
- const bundle = await rollup(optionsObj);
76
- await Promise.all(optionsObj.output.map(bundle.write));
77
- }
78
-
79
- // if supplying your own index.html, this should be copied to the dist folder
80
- try {
81
- if (fs.existsSync(path.join(PACKAGE_ROOT_PATH, "src/index.html"))) {
82
- fs.copyFile(
83
- path.join(PACKAGE_ROOT_PATH, "src/index.html"),
84
- path.join(PACKAGE_DIST_PATH, "index.html"),
85
- (err) => {
86
- if (err) throw err;
87
- console.log(`using ${PACKAGE_ROOT_PATH}, "src/index.html", copied to ${PACKAGE_DIST_PATH}`);
88
- }
89
- );
90
- }
91
- } catch (err) {
92
- console.error(err);
93
- }
94
- });
95
- };
96
-
97
- const run = async () => {
98
- const help = args.indexOf("--help") >= 0 || args.indexOf("-h") >= 0;
99
- const watch = args.indexOf("--watch") >= 0 || args.indexOf("-w") >= 0;
100
- const dev = args.indexOf("--dev") >= 0 || args.indexOf("-d") >= 0;
101
- const target = args.indexOf("--target") >= 0 || args.indexOf("-t") >= 0;
102
-
103
- if (help) {
104
- console.log("--help -h list these commands");
105
- console.log("--build a one of build of your item");
106
- console.log("--watch watch the files");
107
- console.log("--target build a prod item and bundle for platform");
108
- return;
109
- }
110
-
111
- if (watch) {
112
- watchBuild(false);
113
- return;
114
- }
115
-
116
- if (dev) {
117
- const devIndex = args.indexOf("--dev");
118
- if (args.length <= devIndex + 1) {
119
- console.error("Missing dev target name. Using IMS template");
120
- watchBuild(true);
121
- } else {
122
- const target = args[devIndex + 1];
123
- watchBuild(true, target);
124
- }
125
- return;
126
- }
127
-
128
- prodBuild().then(() => {
129
- if (target) {
130
- const targetIndex = args.indexOf("--target");
131
- if (args.length <= targetIndex + 1) {
132
- console.error("Missing target name. Use tspci --target target");
133
- }
134
- const targetname = args[targetIndex + 1];
135
- const scriptFile = path.join(NODE_MODULES, `@citolab\\tspci-${targetname}\\src\\createPackage.mjs`);
136
- import(`file:///${scriptFile}`).then((script) => {
137
- script.bundle();
138
- });
139
- }
140
- });
141
- };
142
-
143
- run();
1
+ #!/usr/bin/env node
2
+ import loadConfigFile from "rollup/dist/loadConfigFile.js";
3
+ import { rollup, watch } from "rollup";
4
+ import path from "path";
5
+ import fs from "fs";
6
+
7
+ const args = process.argv.slice(2);
8
+
9
+ // PK: retreive dirname, most of the time automaticly inserted in es modules
10
+ import { fileURLToPath } from "url";
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+
14
+ const PACKAGE_ROOT_PATH = process.cwd();
15
+ const PACKAGE_DIST_PATH = path.join(PACKAGE_ROOT_PATH, "dist");
16
+ const NODE_MODULES = path.join(process.cwd(), "node_modules");
17
+
18
+ // https://rollupjs.org/guide/en/#programmatically-loading-a-config-file
19
+ const watchBuild = (devServer = false, target = 'IMS') => {
20
+ const rollupFile = devServer ? "rollup.config.dev.js" : "rollup.config.js";
21
+
22
+ fs.rmSync(PACKAGE_DIST_PATH, { recursive: true, force: true });
23
+ !fs.existsSync(PACKAGE_DIST_PATH) && fs.mkdirSync(PACKAGE_DIST_PATH);
24
+
25
+ if (devServer) {
26
+ try {
27
+ if (fs.existsSync(path.join(PACKAGE_ROOT_PATH, "src/index.html"))) {
28
+ fs.copyFile(
29
+ path.join(PACKAGE_ROOT_PATH, "src/index.html"),
30
+ path.join(PACKAGE_DIST_PATH, "index.html"),
31
+ (err) => {
32
+ if (err) throw err;
33
+ console.log("using index.html found in src/index.html, copied to dist");
34
+ }
35
+ );
36
+ } else {
37
+ let fileToCopy;
38
+ if (target == 'IMS') {
39
+ fileToCopy = path.join(__dirname, `../public/index.html`)
40
+ } else {
41
+ fileToCopy = path.join(NODE_MODULES, `@citolab/tspci-${target}/public/index.html`);
42
+ }
43
+ fs.copyFile(fileToCopy, path.join(PACKAGE_DIST_PATH, "index.html"), (err) => {
44
+ if (err) throw err;
45
+ console.log("using index.html was copied to /dist folder pci");
46
+ });
47
+ }
48
+ } catch (err) {
49
+ console.error(err);
50
+ }
51
+ }
52
+ loadConfigFile(path.resolve(__dirname, rollupFile), {}).then(async ({ options, warnings }) => {
53
+ console.log(`We currently have ${warnings.count} warnings`);
54
+ warnings.flush();
55
+ const watcher = watch(options);
56
+ watcher.on("event", (event) => {
57
+ event.code == "START" && console.log("starting build");
58
+ event.code == "ERROR" && console.log("ERROR", event);
59
+ });
60
+ watcher.on("event", ({ result }) => {
61
+ if (result) {
62
+ result.close();
63
+ }
64
+ });
65
+ watcher.close();
66
+ });
67
+ };
68
+
69
+ const prodBuild = async () => {
70
+ fs.rmSync(path.join(PACKAGE_ROOT_PATH, "dist"), { recursive: true, force: true });
71
+ return loadConfigFile(path.resolve(__dirname, "rollup.config.prod.js"), {}).then(async ({ options, warnings }) => {
72
+ console.log(`We currently have ${warnings.count} warnings`);
73
+ warnings.flush();
74
+ for (const optionsObj of options) {
75
+ const bundle = await rollup(optionsObj);
76
+ await Promise.all(optionsObj.output.map(bundle.write));
77
+ }
78
+
79
+ // if supplying your own index.html, this should be copied to the dist folder
80
+ try {
81
+ if (fs.existsSync(path.join(PACKAGE_ROOT_PATH, "src/index.html"))) {
82
+ fs.copyFile(
83
+ path.join(PACKAGE_ROOT_PATH, "src/index.html"),
84
+ path.join(PACKAGE_DIST_PATH, "index.html"),
85
+ (err) => {
86
+ if (err) throw err;
87
+ console.log(`using ${PACKAGE_ROOT_PATH}, "src/index.html", copied to ${PACKAGE_DIST_PATH}`);
88
+ }
89
+ );
90
+ }
91
+ } catch (err) {
92
+ console.error(err);
93
+ }
94
+ });
95
+ };
96
+
97
+ const run = async () => {
98
+ const help = args.indexOf("--help") >= 0 || args.indexOf("-h") >= 0;
99
+ const watch = args.indexOf("--watch") >= 0 || args.indexOf("-w") >= 0;
100
+ const dev = args.indexOf("--dev") >= 0 || args.indexOf("-d") >= 0;
101
+ const target = args.indexOf("--target") >= 0 || args.indexOf("-t") >= 0;
102
+
103
+ if (help) {
104
+ console.log("--help -h list these commands");
105
+ console.log("--build a one of build of your item");
106
+ console.log("--watch watch the files");
107
+ console.log("--target build a prod item and bundle for platform");
108
+ return;
109
+ }
110
+
111
+ if (watch) {
112
+ watchBuild(false);
113
+ return;
114
+ }
115
+
116
+ if (dev) {
117
+ const devIndex = args.indexOf("--dev");
118
+ if (args.length <= devIndex + 1) {
119
+ console.error("Missing dev target name. Using IMS template");
120
+ watchBuild(true);
121
+ } else {
122
+ const target = args[devIndex + 1];
123
+ watchBuild(true, target);
124
+ }
125
+ return;
126
+ }
127
+
128
+ prodBuild().then(() => {
129
+ if (target) {
130
+ const targetIndex = args.indexOf("--target");
131
+ if (args.length <= targetIndex + 1) {
132
+ console.error("Missing target name. Use tspci --target target");
133
+ }
134
+ const targetname = args[targetIndex + 1];
135
+ const scriptFile = path.join(NODE_MODULES, `@citolab\\tspci-${targetname}\\src\\createPackage.mjs`);
136
+ import(`file:///${scriptFile}`).then((script) => {
137
+ script.bundle();
138
+ });
139
+ }
140
+ });
141
+ };
142
+
143
+ run();
@@ -1,32 +1,32 @@
1
- // PK: made a pull request for this https://bitbucket.org/robhicks55/rollup-plugin-live-server/pull-requests/
2
- // WATCH argument added to live server, else this package could just be used
3
- // https://www.npmjs.com/package/rollup-plugin-live-server
4
- const ls = require("live-server");
5
-
6
- export function liveServer(options = {}) {
7
- const directories = options.directories || [];
8
- const params = {
9
- file: options.file || 'index.html',
10
- host: options.host || '0.0.0.0',
11
- logLevel: options.logLevel || 2,
12
- open: options.open || false,
13
- port: options.port ||8080,
14
- root: options.root || '.',
15
- wait: options.wait || 200,
16
- watch: options.watch || "",
17
- };
18
- if (options.mount) params.mount = options.mount;
19
- if (options.ignore) params.ignore = options.ignore;
20
- if (options.middleware) params.middleware = options.middleware;
21
- if (options.cert) params.cert = options.cert;
22
- if (options.key) params.key = options.key;
23
- if (options.passphrase) params.passphrase = options.passphrase;
24
-
25
- ls.start(params);
26
- return {
27
- name: 'liveServer',
28
- generateBundle() {
29
- console.log(`live-server running on ${params.port}`);
30
- }
31
- };
32
- }
1
+ // PK: made a pull request for this https://bitbucket.org/robhicks55/rollup-plugin-live-server/pull-requests/
2
+ // WATCH argument added to live server, else this package could just be used
3
+ // https://www.npmjs.com/package/rollup-plugin-live-server
4
+ const ls = require("live-server");
5
+
6
+ export function liveServer(options = {}) {
7
+ const directories = options.directories || [];
8
+ const params = {
9
+ file: options.file || 'index.html',
10
+ host: options.host || '0.0.0.0',
11
+ logLevel: options.logLevel || 2,
12
+ open: options.open || false,
13
+ port: options.port ||8080,
14
+ root: options.root || '.',
15
+ wait: options.wait || 200,
16
+ watch: options.watch || "",
17
+ };
18
+ if (options.mount) params.mount = options.mount;
19
+ if (options.ignore) params.ignore = options.ignore;
20
+ if (options.middleware) params.middleware = options.middleware;
21
+ if (options.cert) params.cert = options.cert;
22
+ if (options.key) params.key = options.key;
23
+ if (options.passphrase) params.passphrase = options.passphrase;
24
+
25
+ ls.start(params);
26
+ return {
27
+ name: 'liveServer',
28
+ generateBundle() {
29
+ console.log(`live-server running on ${params.port}`);
30
+ }
31
+ };
32
+ }
@@ -1,28 +1,28 @@
1
- import watchAssets from 'rollup-plugin-watch-assets';
2
- // PK: not the official npm package, but a copy, needed watch functinoality
3
- import { liveServer } from "./rollup-plugin-live-server";
4
-
5
- import path from "path";
6
-
7
- const PACKAGE_ROOT_PATH = process.cwd()
8
- const PACKAGE_DIST_PATH = path.join(PACKAGE_ROOT_PATH, "dist")
9
-
10
- const livesrvr = liveServer({
11
- root: path.join(PACKAGE_ROOT_PATH),
12
- mount: [["/", "./dist"]],
13
- open: true,
14
- wait: 500,
15
- watch: PACKAGE_DIST_PATH
16
- });
17
-
18
- const watchassets = watchAssets({ assets: ['./src/**/*.json', './src/**/*.svg', './src/**/*.png'] })
19
-
20
- import rollupConfig from "./rollup.config";
21
-
22
- const newRollupConfig = {
23
- ...rollupConfig,
24
- output: rollupConfig.output.map((output) => ({ ...output, sourcemap: true })),
25
- plugins: [...rollupConfig.plugins, livesrvr, watchassets],
26
- };
27
-
28
- export default newRollupConfig;
1
+ import watchAssets from 'rollup-plugin-watch-assets';
2
+ // PK: not the official npm package, but a copy, needed watch functinoality
3
+ import { liveServer } from "./rollup-plugin-live-server";
4
+
5
+ import path from "path";
6
+
7
+ const PACKAGE_ROOT_PATH = process.cwd()
8
+ const PACKAGE_DIST_PATH = path.join(PACKAGE_ROOT_PATH, "dist")
9
+
10
+ const livesrvr = liveServer({
11
+ root: path.join(PACKAGE_ROOT_PATH),
12
+ mount: [["/", "./dist"]],
13
+ open: true,
14
+ wait: 500,
15
+ watch: PACKAGE_DIST_PATH
16
+ });
17
+
18
+ const watchassets = watchAssets({ assets: ['./src/**/*.json', './src/**/*.svg', './src/**/*.png'] })
19
+
20
+ import rollupConfig from "./rollup.config";
21
+
22
+ const newRollupConfig = {
23
+ ...rollupConfig,
24
+ output: rollupConfig.output.map((output) => ({ ...output, sourcemap: true })),
25
+ plugins: [...rollupConfig.plugins, livesrvr, watchassets],
26
+ };
27
+
28
+ export default newRollupConfig;
@@ -1,83 +1,83 @@
1
- import resolve from "@rollup/plugin-node-resolve";
2
- import typescript from "@rollup/plugin-typescript";
3
- import alias from "@rollup/plugin-alias";
4
- import image from "@rollup/plugin-image";
5
- import replace from "@rollup/plugin-replace";
6
- import postcss from "rollup-plugin-postcss";
7
- import commonjs from "@rollup/plugin-commonjs"; // added this when added react-redux, gave an ' 'default' is not exported by node_modules/prop-types/index.js'
8
- import json from "@rollup/plugin-json";
9
-
10
- // copy, builtins, globals and litTailwind were added for use in simple bundle tool to make qti players
11
- import copy from "rollup-plugin-copy"; // copying assets to the assets folder in dist ( not for PCI, those assets are bundled )
12
- import builtins from 'rollup-plugin-node-builtins'; // was fix for including pixi for QTI component development, see: https://github.com/rollup/rollup/issues/3230#issuecomment-585416594
13
- import globals from 'rollup-plugin-node-globals'; // was fix for including pixi for QTI component development, see: https://github.com/rollup/rollup/issues/3230#issuecomment-585416594
14
- // import litTailwind from "rollup-plugin-lit-tailwindcss3"; // Qti development, custom components can include tailwind classes
15
-
16
- import fs from "fs";
17
- import path from "path";
18
-
19
- const PACKAGE_ROOT_PATH = process.cwd();
20
- const pkg = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT_PATH, "package.json"), "utf-8"));
21
-
22
- export default {
23
- input: [`${pkg.source}`],
24
- external: ["qtiCustomInteractionContext"],
25
- watch: {
26
- include: "./src/**", // fixme: watch these files, does not support watching the css
27
- clearScreen: false, // clears the bash log before running
28
- },
29
- output: [
30
- {
31
- name: `${pkg.name}`,
32
- file: `${pkg.main}`,
33
- format: "umd",
34
- sourcemap: true,
35
- },
36
- ],
37
- plugins: [
38
- globals(),
39
- builtins(),
40
- alias({
41
- // When using third party react libraries, alias them to preact
42
- entries: [
43
- { find: "qtiCustomInteractionContext", replacement: "./qtiShim" },
44
- { find: "react", replacement: "preact/compat" },
45
- { find: "react-dom/test-utils", replacement: "preact/test-utils" },
46
- { find: "react-dom", replacement: "preact/compat" },
47
- { find: "react/jsx-runtime", replacement: "preact/jsx-runtime" },
48
- ],
49
- }),
50
- replace({
51
- values: {
52
- "process.env.NODE_ENV": "false", // added this when bundling gave an 'process is not defined' error
53
- },
54
- }),
55
- resolve({
56
- ignoreGlobal: false,
57
- include: ["node_modules/**"],
58
- dedupe: ["preact"],
59
- browser: true
60
- }),
61
- commonjs({ transformMixedEsModules: true }), // preact was imported twice, with require (unistore/preact) and with import (our import), which resulted in 2 preacts in our project
62
- json(), // used to import config.json
63
- typescript({
64
- tsconfig: `${PACKAGE_ROOT_PATH}/tsconfig.json`,
65
- declarationDir: `${PACKAGE_ROOT_PATH}/dist`
66
- }),
67
- // litTailwind({
68
- // include: "src/components/**/*.ts",
69
- // }),
70
- postcss({
71
- extract: false, // not extracting embeds the js in the build, which is what we need for shipping it
72
- modules: false, // tried modules at first, could work, but not with html in the qti file
73
- inject: false, // does not inject the imported styles in the head
74
- extensions: [".css"],
75
- }),
76
- copy({
77
- targets: [
78
- { src: "src/assets", dest: "dist" }, // copy asses to dist folder
79
- ],
80
- }),
81
- image(), // import images png/svg/gif/jpg and converts to inline code
82
- ],
1
+ import resolve from "@rollup/plugin-node-resolve";
2
+ import typescript from "@rollup/plugin-typescript";
3
+ import alias from "@rollup/plugin-alias";
4
+ import image from "@rollup/plugin-image";
5
+ import replace from "@rollup/plugin-replace";
6
+ import postcss from "rollup-plugin-postcss";
7
+ import commonjs from "@rollup/plugin-commonjs"; // added this when added react-redux, gave an ' 'default' is not exported by node_modules/prop-types/index.js'
8
+ import json from "@rollup/plugin-json";
9
+
10
+ // copy, builtins, globals and litTailwind were added for use in simple bundle tool to make qti players
11
+ import copy from "rollup-plugin-copy"; // copying assets to the assets folder in dist ( not for PCI, those assets are bundled )
12
+ import builtins from 'rollup-plugin-node-builtins'; // was fix for including pixi for QTI component development, see: https://github.com/rollup/rollup/issues/3230#issuecomment-585416594
13
+ import globals from 'rollup-plugin-node-globals'; // was fix for including pixi for QTI component development, see: https://github.com/rollup/rollup/issues/3230#issuecomment-585416594
14
+ // import litTailwind from "rollup-plugin-lit-tailwindcss3"; // Qti development, custom components can include tailwind classes
15
+
16
+ import fs from "fs";
17
+ import path from "path";
18
+
19
+ const PACKAGE_ROOT_PATH = process.cwd();
20
+ const pkg = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT_PATH, "package.json"), "utf-8"));
21
+
22
+ export default {
23
+ input: [`${pkg.source}`],
24
+ external: ["qtiCustomInteractionContext"],
25
+ watch: {
26
+ include: "./src/**", // fixme: watch these files, does not support watching the css
27
+ clearScreen: false, // clears the bash log before running
28
+ },
29
+ output: [
30
+ {
31
+ name: `${pkg.name}`,
32
+ file: `${pkg.main}`,
33
+ format: "umd",
34
+ sourcemap: true,
35
+ },
36
+ ],
37
+ plugins: [
38
+ globals(),
39
+ builtins(),
40
+ alias({
41
+ // When using third party react libraries, alias them to preact
42
+ entries: [
43
+ { find: "qtiCustomInteractionContext", replacement: "./qtiShim" },
44
+ { find: "react", replacement: "preact/compat" },
45
+ { find: "react-dom/test-utils", replacement: "preact/test-utils" },
46
+ { find: "react-dom", replacement: "preact/compat" },
47
+ { find: "react/jsx-runtime", replacement: "preact/jsx-runtime" },
48
+ ],
49
+ }),
50
+ replace({
51
+ values: {
52
+ "process.env.NODE_ENV": "false", // added this when bundling gave an 'process is not defined' error
53
+ },
54
+ }),
55
+ resolve({
56
+ ignoreGlobal: false,
57
+ include: ["node_modules/**"],
58
+ dedupe: ["preact"],
59
+ browser: true
60
+ }),
61
+ commonjs({ transformMixedEsModules: true }), // preact was imported twice, with require (unistore/preact) and with import (our import), which resulted in 2 preacts in our project
62
+ json(), // used to import config.json
63
+ typescript({
64
+ tsconfig: `${PACKAGE_ROOT_PATH}/tsconfig.json`,
65
+ declarationDir: `${PACKAGE_ROOT_PATH}/dist`
66
+ }),
67
+ // litTailwind({
68
+ // include: "src/components/**/*.ts",
69
+ // }),
70
+ postcss({
71
+ extract: false, // not extracting embeds the js in the build, which is what we need for shipping it
72
+ modules: false, // tried modules at first, could work, but not with html in the qti file
73
+ inject: false, // does not inject the imported styles in the head
74
+ extensions: [".css"],
75
+ }),
76
+ copy({
77
+ targets: [
78
+ { src: "src/assets", dest: "dist" }, // copy asses to dist folder
79
+ ],
80
+ }),
81
+ image(), // import images png/svg/gif/jpg and converts to inline code
82
+ ],
83
83
  };
@@ -1,10 +1,10 @@
1
- import { terser } from 'rollup-plugin-terser'
2
- import rollupConfig from "./rollup.config";
3
-
4
- const newRollupConfig = {
5
- ...rollupConfig,
6
- output: rollupConfig.output.map((output) => ({ ...output, sourcemap: false })),
7
- plugins: [...rollupConfig.plugins, terser()],
8
- };
9
-
10
- export default newRollupConfig;
1
+ import { terser } from 'rollup-plugin-terser'
2
+ import rollupConfig from "./rollup.config";
3
+
4
+ const newRollupConfig = {
5
+ ...rollupConfig,
6
+ output: rollupConfig.output.map((output) => ({ ...output, sourcemap: false })),
7
+ plugins: [...rollupConfig.plugins, terser()],
8
+ };
9
+
10
+ export default newRollupConfig;