diff --git a/.eslintcache b/.eslintcache new file mode 100644 index 0000000..dd26c84 --- /dev/null +++ b/.eslintcache @@ -0,0 +1 @@ +[{"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/child_process.js":"1","/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/cross-spawn-promise.js":"2","/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/del.js":"3","/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/fs-extra.js":"4","/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/fs.js":"5","/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/fs.promised.js":"6","/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/inquirer.js":"7","/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/live-server.js":"8","/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/ora.js":"9","/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/path.js":"10","/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/pkg-dir.js":"11","/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/recursive-copy.js":"12","/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/request-promise-native.js":"13","/Users/rene8209/Documents/dev/github/arcgis-js-cli/src/lib/__mocks__/downloadAsync.js":"14","/Users/rene8209/Documents/dev/github/arcgis-js-cli/src/lib/__mocks__/installer.js":"15","/Users/rene8209/Documents/dev/github/arcgis-js-cli/src/lib/__mocks__/readDirR.js":"16"},{"size":778,"mtime":1668099711362,"results":"17","hashOfConfig":"18"},{"size":731,"mtime":1668099711363,"results":"19","hashOfConfig":"18"},{"size":660,"mtime":1668099711364,"results":"20","hashOfConfig":"18"},{"size":1071,"mtime":1668099711364,"results":"21","hashOfConfig":"18"},{"size":1174,"mtime":1668099711365,"results":"22","hashOfConfig":"18"},{"size":1085,"mtime":1668099711365,"results":"23","hashOfConfig":"18"},{"size":813,"mtime":1668099711366,"results":"24","hashOfConfig":"18"},{"size":709,"mtime":1668099711367,"results":"25","hashOfConfig":"18"},{"size":1142,"mtime":1668099711368,"results":"26","hashOfConfig":"18"},{"size":672,"mtime":1668099711368,"results":"27","hashOfConfig":"18"},{"size":766,"mtime":1668099711369,"results":"28","hashOfConfig":"18"},{"size":763,"mtime":1668099711371,"results":"29","hashOfConfig":"18"},{"size":1112,"mtime":1668099711372,"results":"30","hashOfConfig":"18"},{"size":840,"mtime":1668099711380,"results":"31","hashOfConfig":"18"},{"size":766,"mtime":1668099711381,"results":"32","hashOfConfig":"18"},{"size":725,"mtime":1668099711382,"results":"33","hashOfConfig":"18"},{"filePath":"34","messages":"35","errorCount":0,"fatalErrorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"1s9n2sm",{"filePath":"36","messages":"37","errorCount":0,"fatalErrorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"38","messages":"39","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"40","messages":"41","errorCount":0,"fatalErrorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"42","messages":"43","errorCount":0,"fatalErrorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"44","messages":"45","errorCount":0,"fatalErrorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"46","messages":"47","errorCount":0,"fatalErrorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"48","messages":"49","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"50","messages":"51","errorCount":0,"fatalErrorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"52","messages":"53","errorCount":0,"fatalErrorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"54","messages":"55","errorCount":0,"fatalErrorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"56","messages":"57","errorCount":0,"fatalErrorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"58","messages":"59","errorCount":0,"fatalErrorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"60","messages":"61","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"62","messages":"63","errorCount":0,"fatalErrorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"64","messages":"65","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/child_process.js",["66"],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/cross-spawn-promise.js",["67"],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/del.js",[],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/fs-extra.js",["68","69","70","71"],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/fs.js",["72","73","74","75","76","77"],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/fs.promised.js",["78","79","80","81"],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/inquirer.js",["82","83"],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/live-server.js",[],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/ora.js",["84","85"],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/path.js",["86"],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/pkg-dir.js",["87","88"],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/recursive-copy.js",["89","90"],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/__mocks__/request-promise-native.js",["91","92","93"],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/src/lib/__mocks__/downloadAsync.js",[],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/src/lib/__mocks__/installer.js",["94"],"/Users/rene8209/Documents/dev/github/arcgis-js-cli/src/lib/__mocks__/readDirR.js",[],{"ruleId":"95","severity":1,"message":"96","line":18,"column":34,"nodeType":"97","messageId":"98","endLine":18,"endColumn":38},{"ruleId":"95","severity":1,"message":"96","line":17,"column":34,"nodeType":"97","messageId":"98","endLine":17,"endColumn":38},{"ruleId":"95","severity":1,"message":"96","line":21,"column":26,"nodeType":"97","messageId":"98","endLine":21,"endColumn":30},{"ruleId":"95","severity":1,"message":"99","line":22,"column":31,"nodeType":"97","messageId":"98","endLine":22,"endColumn":37},{"ruleId":"95","severity":1,"message":"96","line":27,"column":30,"nodeType":"97","messageId":"98","endLine":27,"endColumn":34},{"ruleId":"95","severity":1,"message":"99","line":32,"column":31,"nodeType":"97","messageId":"98","endLine":32,"endColumn":37},{"ruleId":"95","severity":1,"message":"96","line":18,"column":32,"nodeType":"97","messageId":"98","endLine":18,"endColumn":36},{"ruleId":"95","severity":1,"message":"96","line":19,"column":31,"nodeType":"97","messageId":"98","endLine":19,"endColumn":35},{"ruleId":"95","severity":1,"message":"96","line":21,"column":30,"nodeType":"97","messageId":"98","endLine":21,"endColumn":34},{"ruleId":"95","severity":1,"message":"96","line":29,"column":27,"nodeType":"97","messageId":"98","endLine":29,"endColumn":31},{"ruleId":"95","severity":1,"message":"96","line":32,"column":25,"nodeType":"97","messageId":"98","endLine":32,"endColumn":29},{"ruleId":"95","severity":1,"message":"96","line":33,"column":24,"nodeType":"97","messageId":"98","endLine":33,"endColumn":28},{"ruleId":"95","severity":1,"message":"96","line":20,"column":30,"nodeType":"97","messageId":"98","endLine":20,"endColumn":34},{"ruleId":"95","severity":1,"message":"99","line":25,"column":31,"nodeType":"97","messageId":"98","endLine":25,"endColumn":37},{"ruleId":"95","severity":1,"message":"96","line":30,"column":31,"nodeType":"97","messageId":"98","endLine":30,"endColumn":35},{"ruleId":"95","severity":1,"message":"99","line":31,"column":31,"nodeType":"97","messageId":"98","endLine":31,"endColumn":37},{"ruleId":"95","severity":1,"message":"96","line":16,"column":20,"nodeType":"97","messageId":"98","endLine":16,"endColumn":24},{"ruleId":"95","severity":1,"message":"99","line":20,"column":31,"nodeType":"97","messageId":"98","endLine":20,"endColumn":37},{"ruleId":"95","severity":1,"message":"96","line":17,"column":29,"nodeType":"97","messageId":"98","endLine":17,"endColumn":33},{"ruleId":"95","severity":1,"message":"99","line":18,"column":31,"nodeType":"97","messageId":"98","endLine":18,"endColumn":37},{"ruleId":"95","severity":1,"message":"96","line":16,"column":21,"nodeType":"97","messageId":"98","endLine":16,"endColumn":25},{"ruleId":"95","severity":1,"message":"96","line":16,"column":28,"nodeType":"97","messageId":"98","endLine":16,"endColumn":32},{"ruleId":"95","severity":1,"message":"99","line":17,"column":31,"nodeType":"97","messageId":"98","endLine":17,"endColumn":37},{"ruleId":"95","severity":1,"message":"96","line":17,"column":26,"nodeType":"97","messageId":"98","endLine":17,"endColumn":30},{"ruleId":"95","severity":1,"message":"99","line":18,"column":31,"nodeType":"97","messageId":"98","endLine":18,"endColumn":37},{"ruleId":"100","severity":1,"message":"101","line":36,"column":16,"nodeType":"102","messageId":"103","endLine":36,"endColumn":41},{"ruleId":"100","severity":1,"message":"104","line":36,"column":33,"nodeType":"97","messageId":"105","endLine":36,"endColumn":40},{"ruleId":"95","severity":1,"message":"99","line":43,"column":31,"nodeType":"97","messageId":"98","endLine":43,"endColumn":37},{"ruleId":"95","severity":1,"message":"99","line":18,"column":31,"nodeType":"97","messageId":"98","endLine":18,"endColumn":37},"@typescript-eslint/no-unused-vars","'args' is defined but never used.","Identifier","unusedVar","'reject' is defined but never used.","@typescript-eslint/explicit-module-boundary-types","Missing return type on function.","FunctionDeclaration","missingReturnType","Argument 'options' should be typed.","missingArgType"] \ No newline at end of file diff --git a/LICENSE b/LICENSE index 022db33..ba8e481 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 309f678..5aea04f 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,12 @@ This CLI will allow you to quickly scaffold various applications for the [ArcGIS API for JavaScript](https://developers.arcgis.com/javascript/). +> NOTE: It is highly recommended that you use [Vite](https://vitejs.dev/) directly to build your apps. We also provide a number of [application samples](https://github.com/Esri/jsapi-resources/tree/master/esm-samples) that you can use. The 4.25 release of this CLI will most likely be the last release. There are other tools already suited for using existing repositories for applications, such as [degit](https://github.com/Rich-Harris/degit). + +## 4.25 Breaking Changes + +There is no longer a webpack template provided for this CLI. The only application template uses [Vite](https://vitejs.dev/). You can find webpack application sample [here](https://github.com/Esri/jsapi-resources/tree/master/esm-samples/webpack). + ## Usage ### Prerequisites @@ -44,16 +50,11 @@ Commands: ## Quick Start -> default template webpack application +> template application ```sh arcgis create jsapi-app ``` -> vite template application -```sh -arcgis create jsapi-vite-app -t vite -``` - ## Sample Apps * [ArcGIS Basic App](https://jsapi-basic-416.surge.sh/) @@ -73,7 +74,7 @@ Options: --version Show version number [boolean] --name, -n directory and package name for the new app --dest Directory to create the application in [default: ] - --type, -t A project template [choices: "jsapi". "vite"] [default: "jsapi"] + --type, -t A project template [choices: "jsapi"] [default: "jsapi"] -h, --help Show help [boolean] ``` @@ -87,7 +88,7 @@ Initialize a new application in current directory Options: --version Show version number [boolean] - --type, -t A project template [choices: "jsapi". "vite"] [default: "jsapi"] + --type, -t A project template [choices: "jsapi"] [default: "jsapi"] -h, --help Show help [boolean] ``` @@ -251,7 +252,7 @@ Anyone and everyone is welcome to [contribute](CONTRIBUTING.md). We do accept pu 4. Improve documentation ## Licensing -Copyright 2020 Esri +Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/__mocks__/child_process.js b/__mocks__/child_process.js index 75ac698..dfd5847 100644 --- a/__mocks__/child_process.js +++ b/__mocks__/child_process.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -16,9 +16,9 @@ const child_process = {}; export const spawn = jest.fn((...args) => { - return { - kill () {} - }; + return { + kill() {}, + }; }); child_process.spawn = spawn; diff --git a/__mocks__/cross-spawn-promise.js b/__mocks__/cross-spawn-promise.js index 429096d..8342e27 100644 --- a/__mocks__/cross-spawn-promise.js +++ b/__mocks__/cross-spawn-promise.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -15,9 +15,9 @@ /* global jest */ export const spawn = jest.fn((...args) => { - return Promise.resolve({ - kill() {} - }); + return Promise.resolve({ + kill() {}, + }); }); export default spawn; diff --git a/__mocks__/del.js b/__mocks__/del.js index dd0e300..05c59b7 100644 --- a/__mocks__/del.js +++ b/__mocks__/del.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/__mocks__/fs-extra.js b/__mocks__/fs-extra.js index 43c05a5..e5a4375 100644 --- a/__mocks__/fs-extra.js +++ b/__mocks__/fs-extra.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -19,21 +19,19 @@ const fse = {}; fse.__RETURN = null; const copy = jest.fn((...args) => { - return new Promise((resolve, reject) => { - process.nextTick( - () => resolve() - ); - }); + return new Promise((resolve, reject) => { + process.nextTick(() => resolve()); + }); }); const readFile = jest.fn((...args) => { - const file = `{ + const file = `{ "name": "Sam" }`; - let result = fse.__RETURN ? fse.__RETURN : file; - return new Promise((resolve, reject) => { - process.nextTick(() => resolve(result)); - }); + let result = fse.__RETURN ? fse.__RETURN : file; + return new Promise((resolve, reject) => { + process.nextTick(() => resolve(result)); + }); }); fse.copy = copy; diff --git a/__mocks__/fs.js b/__mocks__/fs.js index 7b63afd..9086ddf 100644 --- a/__mocks__/fs.js +++ b/__mocks__/fs.js @@ -1,6 +1,6 @@ /* eslint spaced-comment:0 */ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -19,9 +19,9 @@ const existsSync = jest.fn((...args) => true); const mkdirSync = jest.fn((...args) => {}); const statSync = jest.fn((...args) => { - return { - isDirectory: jest.fn(() => true) - }; + return { + isDirectory: jest.fn(() => true), + }; }); const readdirSync = jest.fn(() => []); @@ -29,8 +29,8 @@ const readdirSync = jest.fn(() => []); const rmdir = jest.fn((...args) => []); export const promises = { - writeFile: jest.fn((...args) => []), - readFile: jest.fn((...args) => {}) + writeFile: jest.fn((...args) => []), + readFile: jest.fn((...args) => {}), }; fs.statSync = statSync; diff --git a/__mocks__/fs.promised.js b/__mocks__/fs.promised.js index 89debf5..a29ddc2 100644 --- a/__mocks__/fs.promised.js +++ b/__mocks__/fs.promised.js @@ -1,6 +1,6 @@ /* eslint spaced-comment:0 */ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -18,19 +18,19 @@ const fsp = {}; fsp.__RETURN = null; const readFile = jest.fn((...args) => { - const file = `{ + const file = `{ "name": "Sam" }`; - let result = fsp.__RETURN ? fsp.__RETURN : file; - return new Promise((resolve, reject) => { - process.nextTick(() => resolve(result)); - }); + let result = fsp.__RETURN ? fsp.__RETURN : file; + return new Promise((resolve, reject) => { + process.nextTick(() => resolve(result)); + }); }); const writeFile = jest.fn((...args) => { - return new Promise((resolve, reject) => { - process.nextTick(() => resolve()); - }); + return new Promise((resolve, reject) => { + process.nextTick(() => resolve()); + }); }); fsp.readFile = readFile; diff --git a/__mocks__/inquirer.js b/__mocks__/inquirer.js index 365b1f9..2913ca9 100644 --- a/__mocks__/inquirer.js +++ b/__mocks__/inquirer.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -14,14 +14,12 @@ const inquirer = {}; const prompt = (...args) => { - const answers = { - tpltype: "storymap" - }; - return new Promise((resolve, reject) => { - process.nextTick( - () => resolve(answers) - ); - }); + const answers = { + tpltype: 'storymap', + }; + return new Promise((resolve, reject) => { + process.nextTick(() => resolve(answers)); + }); }; inquirer.prompt = prompt; diff --git a/__mocks__/live-server.js b/__mocks__/live-server.js index 931f5ff..21b3dce 100644 --- a/__mocks__/live-server.js +++ b/__mocks__/live-server.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -14,9 +14,9 @@ /* eslint spaced-comment:0 */ /* global jest */ const liveServer = () => { - return { - start: jest.fn() - }; + return { + start: jest.fn(), + }; }; export default liveServer(); diff --git a/__mocks__/ora.js b/__mocks__/ora.js index 5861553..b8d2ca2 100644 --- a/__mocks__/ora.js +++ b/__mocks__/ora.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -15,33 +15,33 @@ /* global jest */ const succeed = jest.fn((...args) => { - return new Promise((resolve, reject) => { - process.nextTick(() => resolve()); - }); + return new Promise((resolve, reject) => { + process.nextTick(() => resolve()); + }); }); -const ora = jest.fn().mockImplementation(args => { - ora.__text = args.text; - return { - start: jest.fn(() => { - return { - info() {}, - start() {}, - stop() {}, - fail() {}, - get text() { - return ora.__text; - }, - set text(v) { - ora.__text = v; - }, - succeed - }; - }), - stop() {}, - succeed, - fail() {} - }; +const ora = jest.fn().mockImplementation((args) => { + ora.__text = args.text; + return { + start: jest.fn(() => { + return { + info() {}, + start() {}, + stop() {}, + fail() {}, + get text() { + return ora.__text; + }, + set text(v) { + ora.__text = v; + }, + succeed, + }; + }), + stop() {}, + succeed, + fail() {}, + }; }); ora.__succeed = succeed; diff --git a/__mocks__/path.js b/__mocks__/path.js index a7eba35..8cff2ce 100644 --- a/__mocks__/path.js +++ b/__mocks__/path.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -13,7 +13,7 @@ const path = {}; -const resolve = (...args) => "~redcup"; +const resolve = (...args) => '~redcup'; path.resolve = resolve; diff --git a/__mocks__/pkg-dir.js b/__mocks__/pkg-dir.js index 6c286a8..390fd7d 100644 --- a/__mocks__/pkg-dir.js +++ b/__mocks__/pkg-dir.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -14,9 +14,9 @@ /* eslint spaced-comment:0 */ /* global jest */ const pkgDir = jest.fn((...args) => { - return new Promise((resolve, reject) => { - process.nextTick(() => resolve()); - }); + return new Promise((resolve, reject) => { + process.nextTick(() => resolve()); + }); }); export default pkgDir; diff --git a/__mocks__/recursive-copy.js b/__mocks__/recursive-copy.js index d1dc12c..69bda5a 100644 --- a/__mocks__/recursive-copy.js +++ b/__mocks__/recursive-copy.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -15,11 +15,9 @@ /* global jest */ const copy = jest.fn((...args) => { - return new Promise((resolve, reject) => { - process.nextTick( - () => resolve() - ); - }); + return new Promise((resolve, reject) => { + process.nextTick(() => resolve()); + }); }); export default copy; diff --git a/__mocks__/request-promise-native.js b/__mocks__/request-promise-native.js index f1c405e..5bb0c62 100644 --- a/__mocks__/request-promise-native.js +++ b/__mocks__/request-promise-native.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -12,38 +12,35 @@ */ const templates = [ - { - name: "storymap", - full_name: "Esri/storymap" - }, - { - name: "maptemplate", - full_name: "Esri/maptemplate" - } + { + name: 'storymap', + full_name: 'Esri/storymap', + }, + { + name: 'maptemplate', + full_name: 'Esri/maptemplate', + }, ]; const storymaps = [ - { - name: "storymap", - full_name: "Esri/storymap" - }, - { - name: "storymap-journal", - full_name: "Esri/storymap-journal" - } + { + name: 'storymap', + full_name: 'Esri/storymap', + }, + { + name: 'storymap-journal', + full_name: 'Esri/storymap-journal', + }, ]; -export default function request (options) { - let items; - if (options.uri.includes("template")) { - items = templates; - } - else { - items = storymaps; - } - return new Promise((resolve, reject) => { - process.nextTick( - () => resolve({ items }) - ); - }); +export default function request(options) { + let items; + if (options.uri.includes('template')) { + items = templates; + } else { + items = storymaps; + } + return new Promise((resolve, reject) => { + process.nextTick(() => resolve({ items })); + }); } diff --git a/package.json b/package.json index d6a3bc0..c508b9a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@arcgis/cli", - "version": "4.23.0", + "version": "4.25.0", "description": "CLI to scaffold ArcGIS API for JavaScript applications", "main": "dist/index.js", "bin": { @@ -30,7 +30,7 @@ ], "lint-staged": { "*.ts": [ - "eslint" + "eslint --fix" ], "*.js": "eslint --cache --fix" }, @@ -82,7 +82,6 @@ }, "eslintConfig": { "env": { - "root": true, "node": true }, "parser": "@typescript-eslint/parser", @@ -108,8 +107,6 @@ "useTabs": true }, "dependencies": { - "@esri/calcite-components": "1.0.0-beta.69", - "arcgis-js-api": "4.22.2", "browser-sync": "^2.27.5", "chalk": "^4.1.2", "chokidar": "^3.5.2", diff --git a/src/commands/create.test.ts b/src/commands/create.test.ts index 84dcbbc..0cb6306 100644 --- a/src/commands/create.test.ts +++ b/src/commands/create.test.ts @@ -1,7 +1,7 @@ /* eslint spaced-comment:0 */ /* global afterAll, expect, test, jest */ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/commands/create.ts b/src/commands/create.ts index 96071c9..006d09e 100644 --- a/src/commands/create.ts +++ b/src/commands/create.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/commands/init.test.ts b/src/commands/init.test.ts index edce7db..2c9504a 100644 --- a/src/commands/init.test.ts +++ b/src/commands/init.test.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/commands/init.ts b/src/commands/init.ts index c7c8ae0..c0237f9 100644 --- a/src/commands/init.ts +++ b/src/commands/init.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/commands/widget.test.ts b/src/commands/widget.test.ts index 048b999..6c8e56b 100644 --- a/src/commands/widget.test.ts +++ b/src/commands/widget.test.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/commands/widget.ts b/src/commands/widget.ts index 939ba82..4a27c74 100644 --- a/src/commands/widget.ts +++ b/src/commands/widget.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/index.ts b/src/index.ts index f1f9abb..7af85de 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/lib/__mocks__/downloadAsync.js b/src/lib/__mocks__/downloadAsync.js index 72c1d3e..f5ff7ea 100644 --- a/src/lib/__mocks__/downloadAsync.js +++ b/src/lib/__mocks__/downloadAsync.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/lib/__mocks__/installer.js b/src/lib/__mocks__/installer.js index c11aab6..f67826d 100644 --- a/src/lib/__mocks__/installer.js +++ b/src/lib/__mocks__/installer.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/lib/__mocks__/readDirR.js b/src/lib/__mocks__/readDirR.js index 8d2326d..19a21d2 100644 --- a/src/lib/__mocks__/readDirR.js +++ b/src/lib/__mocks__/readDirR.js @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/lib/cleanDirectories.ts b/src/lib/cleanDirectories.ts index 034a3f0..5962554 100644 --- a/src/lib/cleanDirectories.ts +++ b/src/lib/cleanDirectories.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/lib/copyTemplate.ts b/src/lib/copyTemplate.ts index a96c2b4..e39984a 100644 --- a/src/lib/copyTemplate.ts +++ b/src/lib/copyTemplate.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -23,7 +23,7 @@ type Args = { type?: string; }; -const BASIC = 'templates/webpack/app'; +const BASIC = 'templates/vite/app'; const VITE = 'templates/vite/app'; const gitignore = ` @@ -46,10 +46,7 @@ coverage/* `; const copyTemplate = async (arg: Args, init = false): Promise => { - let templateDirectory = BASIC; - if (arg.type === 'vite') { - templateDirectory = VITE; - } + const templateDirectory = VITE; let target: string; if (!init) { diff --git a/src/lib/copyUpdateFiles.ts b/src/lib/copyUpdateFiles.ts index 94293b2..16bfd70 100644 --- a/src/lib/copyUpdateFiles.ts +++ b/src/lib/copyUpdateFiles.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/lib/createApp.test.ts b/src/lib/createApp.test.ts index d19b693..f283eae 100644 --- a/src/lib/createApp.test.ts +++ b/src/lib/createApp.test.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/lib/createApp.ts b/src/lib/createApp.ts index fa0aacb..778d336 100644 --- a/src/lib/createApp.ts +++ b/src/lib/createApp.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/lib/createWidget.ts b/src/lib/createWidget.ts index b020570..7097927 100644 --- a/src/lib/createWidget.ts +++ b/src/lib/createWidget.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/lib/depsInstall.ts b/src/lib/depsInstall.ts index 8d50e22..f43f6bf 100644 --- a/src/lib/depsInstall.ts +++ b/src/lib/depsInstall.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/lib/installer.ts b/src/lib/installer.ts index 8d993b3..4c3dee1 100644 --- a/src/lib/installer.ts +++ b/src/lib/installer.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/src/lib/readDirR.ts b/src/lib/readDirR.ts index 7d5e930..2d19d6b 100644 --- a/src/lib/readDirR.ts +++ b/src/lib/readDirR.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 Esri + Copyright 2022 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/templates/vite/app/.gitignore b/templates/vite/app/.gitignore index 1574197..963d97e 100644 --- a/templates/vite/app/.gitignore +++ b/templates/vite/app/.gitignore @@ -1,18 +1,17 @@ + node_modules/* .vscode/* build/* dist/* +output/* html-report/* ~tmp/* .baseDir* .tsdrc .tscache npm-debug.log +yarn.lock +package-lock.json coverage-final.* *.env -*.local coverage/* -debug.log -coverage -.DS_Store -dist-ssr \ No newline at end of file diff --git a/templates/vite/app/package.json b/templates/vite/app/package.json index 9b4f39b..1688205 100644 --- a/templates/vite/app/package.json +++ b/templates/vite/app/package.json @@ -1,5 +1,5 @@ { - "name": "jsapi-vite-template", + "name": "jsapi-425", "version": "0.0.0", "scripts": { "start": "vite", @@ -7,7 +7,8 @@ "serve": "vite preview", "prettier": "prettier --write \"src/**/*.ts?(x)\"", "lint": "eslint . --ext .js,.ts,.tsx --fix", - "test": "jest --coverage --passWithNoTests", + "test": "vitest", + "coverage": "vitest run --coverage", "precommit": "lint-staged" }, "eslintConfig": { @@ -23,8 +24,7 @@ "ignorePatterns": [ "vite.config.js", "*.d.ts", - "dist/", - "__mocks__" + "dist/" ], "rules": { "@typescript-eslint/no-empty-function": 0, @@ -59,45 +59,25 @@ "eslint --fix" ] }, - "jest": { - "roots": [ - "/src" - ], - "testEnvironment": "jsdom", - "moduleDirectories": [ - "node_modules", - "src" - ], - "extensionsToTreatAsEsm": [ - ".ts" - ], - "transformIgnorePatterns": [ - "node_modules/(?!@arcgis)" - ], - "transform": { - "^.+\\.tsx?$": "ts-jest" - } - }, "devDependencies": { - "@types/jest": "^27.0.1", - "@typescript-eslint/eslint-plugin": "^5.6.0", - "@typescript-eslint/parser": "^5.6.0", - "eslint": "^8.4.1", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-prettier": "^4.0.0", - "husky": "^7.0.2", - "jest": "^27.2.1", - "lint-staged": "^12.1.2", - "prettier": "^2.4.1", - "ts-jest": "^27.0.5", - "typescript": "^4.3.2", - "vite": "^2.5.4", - "vite-plugin-pwa": "^0.11.2" + "@typescript-eslint/eslint-plugin": "^5.42.1", + "@typescript-eslint/parser": "^5.42.1", + "@vitest/coverage-c8": "^0.25.1", + "eslint": "^8.27.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-prettier": "^4.2.1", + "husky": "^8.0.2", + "lint-staged": "^13.0.3", + "prettier": "^2.7.1", + "typescript": "^4.8.4", + "vite": "^3.2.3", + "vite-plugin-pwa": "^0.13.3", + "vitest": "^0.25.1" }, "dependencies": { - "@arcgis/core": "~4.23.0" + "@arcgis/core": "~4.25.0" }, "arcgis": { - "type": "vite" + "type": "jsapi" } } diff --git a/templates/vite/app/src/__mocks__/@arcgis/core/core/Accessor.ts b/templates/vite/app/src/__mocks__/@arcgis/core/core/Accessor.ts deleted file mode 100644 index 0ac5074..0000000 --- a/templates/vite/app/src/__mocks__/@arcgis/core/core/Accessor.ts +++ /dev/null @@ -1 +0,0 @@ -export default class Accessor {} diff --git a/templates/vite/app/src/__mocks__/@arcgis/core/core/accessorSupport/decorators.ts b/templates/vite/app/src/__mocks__/@arcgis/core/core/accessorSupport/decorators.ts deleted file mode 100644 index ab5096e..0000000 --- a/templates/vite/app/src/__mocks__/@arcgis/core/core/accessorSupport/decorators.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const property = () => {}; -export const subclass = () => {}; diff --git a/templates/vite/app/src/__mocks__/@arcgis/core/core/watchUtils.ts b/templates/vite/app/src/__mocks__/@arcgis/core/core/watchUtils.ts deleted file mode 100644 index 227ff43..0000000 --- a/templates/vite/app/src/__mocks__/@arcgis/core/core/watchUtils.ts +++ /dev/null @@ -1 +0,0 @@ -export function whenOnce() {} diff --git a/templates/vite/app/src/__mocks__/@arcgis/core/widgets/LayerList.ts b/templates/vite/app/src/__mocks__/@arcgis/core/widgets/LayerList.ts deleted file mode 100644 index 1cfa5fe..0000000 --- a/templates/vite/app/src/__mocks__/@arcgis/core/widgets/LayerList.ts +++ /dev/null @@ -1,8 +0,0 @@ -import esri = __esri; -export default class LayerList { - view!: esri.MapViewProperties | esri.SceneViewProperties | undefined; - container!: HTMLDivElement; - constructor(params?: esri.LayerListProperties) { - this.view = params?.view; - } -} diff --git a/templates/vite/app/src/__mocks__/@arcgis/core/widgets/Legend.ts b/templates/vite/app/src/__mocks__/@arcgis/core/widgets/Legend.ts deleted file mode 100644 index 282e936..0000000 --- a/templates/vite/app/src/__mocks__/@arcgis/core/widgets/Legend.ts +++ /dev/null @@ -1,8 +0,0 @@ -import esri = __esri; -export default class Legend { - view!: esri.MapViewProperties | esri.SceneViewProperties | undefined; - container!: HTMLDivElement; - constructor(params?: esri.LegendProperties) { - this.view = params?.view; - } -} diff --git a/templates/vite/app/src/__mocks__/@arcgis/core/widgets/Search.ts b/templates/vite/app/src/__mocks__/@arcgis/core/widgets/Search.ts deleted file mode 100644 index 31a2c96..0000000 --- a/templates/vite/app/src/__mocks__/@arcgis/core/widgets/Search.ts +++ /dev/null @@ -1,8 +0,0 @@ -import esri = __esri; -export default class Search { - view!: esri.MapViewProperties | esri.SceneViewProperties | undefined; - container!: HTMLDivElement; - constructor(params?: __esri.SearchProperties) { - params; - } -} diff --git a/templates/vite/app/src/__mocks__/@arcgis/core/widgets/Search/LayerSearchSource.ts b/templates/vite/app/src/__mocks__/@arcgis/core/widgets/Search/LayerSearchSource.ts deleted file mode 100644 index 4f8ea21..0000000 --- a/templates/vite/app/src/__mocks__/@arcgis/core/widgets/Search/LayerSearchSource.ts +++ /dev/null @@ -1,5 +0,0 @@ -export default class LayerSearchSource { - constructor(params?: any) { - params; - } -} diff --git a/templates/vite/app/src/style.css b/templates/vite/app/src/style.css index 600b817..05b124a 100644 --- a/templates/vite/app/src/style.css +++ b/templates/vite/app/src/style.css @@ -1,7 +1,7 @@ /************************************************* Custom ArcGIS JavaScript API theming. *************************************************/ -@import url("https://js.arcgis.com/4.21/esri/themes/light/main.css"); +@import url("https://js.arcgis.com/4.25/esri/themes/light/main.css"); @import "./_variables.css"; diff --git a/templates/vite/app/src/widgets.spec.ts b/templates/vite/app/src/widgets.spec.ts index 612a97b..8abdb11 100644 --- a/templates/vite/app/src/widgets.spec.ts +++ b/templates/vite/app/src/widgets.spec.ts @@ -1,9 +1,27 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ +import { expect, describe, it, vi } from 'vitest'; import { initWidgets } from './widgets'; -jest.mock('@arcgis/core/widgets/LayerList'); -jest.mock('@arcgis/core/widgets/Legend'); -jest.mock('@arcgis/core/widgets/Search'); +vi.mock('@arcgis/core/widgets/LayerList', () => { + return { + default: vi.fn(() => ({})), + }; +}); +vi.mock('@arcgis/core/widgets/Legend', () => { + return { + default: vi.fn(() => ({})), + }; +}); +vi.mock('@arcgis/core/widgets/Search', () => { + return { + default: vi.fn(() => ({})), + }; +}); + +vi.mock('@arcgis/core/widgets/Search/LayerSearchSource', () => { + return { + default: vi.fn(() => ({})), + }; +}); describe('widgets', () => { it('initializes widgets in view', () => { diff --git a/templates/webpack/app/.gitignore b/templates/webpack/app/.gitignore deleted file mode 100644 index 29bb730..0000000 --- a/templates/webpack/app/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -# override cli .gitignore -# can be removed from scaffolded app -!src/assets - -node_modules/* -.vscode/* -build/* -dist/* -html-report/* -~tmp/* -.baseDir* -.tsdrc -.tscache -npm-debug.log -coverage-final.* -*.env -*.env.local -coverage/* -debug.log diff --git a/templates/webpack/app/README.md b/templates/webpack/app/README.md deleted file mode 100644 index 9b7e265..0000000 --- a/templates/webpack/app/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# ArcGIS API for JavaScript with webpack - -This project was bootstrapped with the [`@arcgis/cli`](https://github.com/Esri/arcgis-js-cli). - -For additional information, see the [Build with ES modules](https://developers.arcgis.com/javascript/latest/es-modules/) Guide topic in the SDK. - -## Commands - -- `npm start` to run in development mode. -- `npm run build` to create a deployable build. -- `npm test` to run tests. \ No newline at end of file diff --git a/templates/webpack/app/package.json b/templates/webpack/app/package.json deleted file mode 100644 index a848579..0000000 --- a/templates/webpack/app/package.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "name": "jsapi-cli-basic", - "version": "0.0.1", - "type": "module", - "description": "ArcGIS API for JavaScript Webpack template application.", - "author": { - "name": "arcgis-js-cli", - "url": "https://github.com/Esri/arcgis-js-cli" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Esri/arcgis-js-cli.git" - }, - "license": "Apache-2.0", - "dependencies": { - "@arcgis/core": "~4.23.0" - }, - "devDependencies": { - "@arcgis/webpack-plugin": "~4.22.0", - "@types/jest": "^27.0.1", - "@typescript-eslint/eslint-plugin": "^5.6.0", - "@typescript-eslint/parser": "^5.6.0", - "copy-webpack-plugin": "^10.1.0", - "css-loader": "^6.2.0", - "css-minimizer-webpack-plugin": "^3.0.2", - "dotenv-webpack": "^7.0.3", - "eslint": "^8.4.1", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-prettier": "^4.0.0", - "file-loader": "^6.2.0", - "html-inline-css-webpack-plugin": "^1.11.1", - "html-webpack-plugin": "^5.3.2", - "husky": "^7.0.2", - "jest": "^27.2.0", - "lint-staged": "^12.1.2", - "mini-css-extract-plugin": "^2.3.0", - "prettier": "^2.4.0", - "resolve-url-loader": "^4.0.0", - "sass": "^1.39.2", - "sass-loader": "^12.1.0", - "terser-webpack-plugin": "^5.2.4", - "ts-jest": "^27.0.5", - "ts-loader": "^9.2.5", - "tslib": "^2.3.1", - "typescript": "^4.4.3", - "webpack": "^5.52.1", - "webpack-cli": "^4.8.0", - "webpack-dev-server": "^4.2.0", - "workbox-webpack-plugin": "^6.3.0" - }, - "scripts": { - "build": "webpack --mode production", - "start": "webpack serve --mode development", - "prettier": "prettier --write \"src/**/*.ts?(x)\"", - "prettier-webpack": "prettier --write webpack.config.js", - "lint": "eslint . --ext .js,.ts,.tsx --fix", - "test": "jest --coverage --passWithNoTests", - "precommit": "lint-staged" - }, - "eslintConfig": { - "env": { - "browser": true, - "node": true - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 2020, - "sourceType": "module" - }, - "ignorePatterns": [ - "webpack.config.js", - "*.d.ts", - "dist/", - "__mocks__" - ], - "rules": { - "@typescript-eslint/no-empty-function": 0, - "@typescript-eslint/ban-ts-comment": 1, - "@typescript-eslint/no-unused-vars": [ - "error", - { - "argsIgnorePattern": "^_|^h" - } - ] - }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:prettier/recommended" - ], - "plugins": [ - "prettier", - "@typescript-eslint" - ] - }, - "prettier": { - "semi": true, - "singleQuote": true, - "trailingComma": "all", - "printWidth": 120, - "tabWidth": 2 - }, - "jest": { - "roots": [ - "/src" - ], - "moduleDirectories": [ - "node_modules", - "src" - ], - "extensionsToTreatAsEsm": [ - ".ts" - ], - "transformIgnorePatterns": [ - "node_modules/(?!@arcgis)" - ], - "transform": { - "^.+\\.tsx?$": "ts-jest" - } - }, - "lint-staged": { - "*.{ts,tsx}": [ - "prettier --write", - "eslint --fix" - ] - }, - "arcgis": { - "type": "jsapi" - } -} diff --git a/templates/webpack/app/src/__mocks__/@arcgis/core/core/Accessor.ts b/templates/webpack/app/src/__mocks__/@arcgis/core/core/Accessor.ts deleted file mode 100644 index 0ac5074..0000000 --- a/templates/webpack/app/src/__mocks__/@arcgis/core/core/Accessor.ts +++ /dev/null @@ -1 +0,0 @@ -export default class Accessor {} diff --git a/templates/webpack/app/src/__mocks__/@arcgis/core/core/accessorSupport/decorators.ts b/templates/webpack/app/src/__mocks__/@arcgis/core/core/accessorSupport/decorators.ts deleted file mode 100644 index ab5096e..0000000 --- a/templates/webpack/app/src/__mocks__/@arcgis/core/core/accessorSupport/decorators.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const property = () => {}; -export const subclass = () => {}; diff --git a/templates/webpack/app/src/__mocks__/@arcgis/core/core/watchUtils.ts b/templates/webpack/app/src/__mocks__/@arcgis/core/core/watchUtils.ts deleted file mode 100644 index 227ff43..0000000 --- a/templates/webpack/app/src/__mocks__/@arcgis/core/core/watchUtils.ts +++ /dev/null @@ -1 +0,0 @@ -export function whenOnce() {} diff --git a/templates/webpack/app/src/__mocks__/@arcgis/core/widgets/LayerList.ts b/templates/webpack/app/src/__mocks__/@arcgis/core/widgets/LayerList.ts deleted file mode 100644 index 1cfa5fe..0000000 --- a/templates/webpack/app/src/__mocks__/@arcgis/core/widgets/LayerList.ts +++ /dev/null @@ -1,8 +0,0 @@ -import esri = __esri; -export default class LayerList { - view!: esri.MapViewProperties | esri.SceneViewProperties | undefined; - container!: HTMLDivElement; - constructor(params?: esri.LayerListProperties) { - this.view = params?.view; - } -} diff --git a/templates/webpack/app/src/__mocks__/@arcgis/core/widgets/Legend.ts b/templates/webpack/app/src/__mocks__/@arcgis/core/widgets/Legend.ts deleted file mode 100644 index 282e936..0000000 --- a/templates/webpack/app/src/__mocks__/@arcgis/core/widgets/Legend.ts +++ /dev/null @@ -1,8 +0,0 @@ -import esri = __esri; -export default class Legend { - view!: esri.MapViewProperties | esri.SceneViewProperties | undefined; - container!: HTMLDivElement; - constructor(params?: esri.LegendProperties) { - this.view = params?.view; - } -} diff --git a/templates/webpack/app/src/assets/socialcard.png b/templates/webpack/app/src/assets/socialcard.png deleted file mode 100644 index f991bca..0000000 Binary files a/templates/webpack/app/src/assets/socialcard.png and /dev/null differ diff --git a/templates/webpack/app/src/index.ejs b/templates/webpack/app/src/index.ejs deleted file mode 100644 index 9dacc13..0000000 --- a/templates/webpack/app/src/index.ejs +++ /dev/null @@ -1,35 +0,0 @@ - - - - - <%= htmlWebpackPlugin.options.title %> - <% if (htmlWebpackPlugin.options.mode === 'production') { %> - - <% } %> - - - - - -
-
-
<%= htmlWebpackPlugin.options.title %>
- -
-
-
- - diff --git a/templates/webpack/app/src/index.scss b/templates/webpack/app/src/index.scss deleted file mode 100644 index ba0e598..0000000 --- a/templates/webpack/app/src/index.scss +++ /dev/null @@ -1,173 +0,0 @@ -/************************************************* - Custom ArcGIS JavaScript API theming. -*************************************************/ - -// Color variables. -@import "~@arcgis/core/assets/esri/themes/base/functions"; -@import "~@arcgis/core/assets/esri/themes/base/colors/scss/variables"; // calcite colors - -$font-color: $Calcite_Gray_700 !default; -$interactive-font-color: $Calcite_Gray_550 !default; -$background-color: $Calcite_Gray_050 !default; - -$interactive-font-color--inverse: $Calcite_Gray_050 !default; -$background-color--inverse: $Calcite_Gray_650 !default; - -$interactive-font-color--hover: offset-foreground-color($interactive-font-color, 25%) !default; -$background-color--hover: offset-background-color($background-color, 4.75%) !default; -$border-color--hover: offset-foreground-color($interactive-font-color, 50%) !default; - -$border-color--active: $Calcite_Highlight_Blue_350 !default; -$background-color--active: $Calcite_Highlight_Blue_100 !default; - -$background-color--offset: offset-background-color($background-color, 4.75%); -$background-color--offset-subtle: offset-background-color($background-color, 3.5%); - -$button-color: $Calcite_Highlight_Blue_350 !default; -$button-color--bright: $Calcite_Blue_a100 !default; -$button-color--hover: darken($button-color, 10%) !default; -$button-color--inverse: $interactive-font-color--inverse !default; - -$heading-color: $font-color !default; -$background-color--overlay: rgba(0, 0, 0, 0.7) !default; -$opacity--disabled: 0.4 !default; -$opacity--sortable: 0.75 !default; -$interactive-font-color--disabled: rgba($interactive-font-color, $opacity--disabled) !default; -$font-color--placeholder: rgba($font-color, $opacity--disabled) !default; -$border-color: rgba($interactive-font-color, 0.3) !default; -$border-color--subtle: rgba($interactive-font-color, 0.15) !default; -$border-color--contrast: rgba($interactive-font-color, 0.4) !default; - -$border-color--error: $Calcite_Vibrant_Red_200 !default; -$font-color--error: $Calcite_Red_a250 !default; -$background-color--error: rgba($font-color--error, 0.1); - -$smartmapping-slider__thumb-background-color: $interactive-font-color !default; -$smartmapping-slider__ramp-stroke-color: $interactive-font-color !default; - -// Widgets to include. -// Set to `false` here by default. Comment out to include. -$include_AreaMeasurement2D: false !default; -$include_AreaMeasurement3D: false !default; -$include_Attachments: false !default; -// $include_Attribution: false !default; -$include_BasemapGallery: false !default; -$include_BasemapLayerList: false !default; -$include_BasemapToggle: false !default; -$include_BinaryColorSizeSlider: false !default; -$include_Bookmarks: false !default; -$include_BuildingExplorer: false !default; -$include_ButtonMenu: false !default; -$include_ClassedColorSlider: false !default; -$include_ClassedSizeSlider: false !default; -$include_Compass: false !default; -$include_ColorSizeSlider: false !default; -$include_ColorSlider: false !default; -$include_CoordinateConversion: false !default; -$include_DatePicker: false !default; -$include_Daylight: false !default; -$include_Directions: false !default; -$include_DirectLineMeasurement3D: false !default; -$include_DistanceMeasurement2D: false !default; -$include_Editor: false !default; -$include_ElevationProfile: false !default; -$include_Expand: false !default; -$include_Feature: false !default; -$include_FeatureContent: false !default; -$include_FeatureMedia: false !default; -$include_FeatureForm: false !default; -$include_FeatureTable: false !default; -$include_FeatureTemplates: false !default; -$include_Grid: false !default; -$include_HeatmapSlider: false !default; -$include_Histogram: false !default; -$include_HistogramRangeSlider: false !default; -$include_IdentityForm: false !default; -$include_IdentityModal: false !default; -$include_ItemList: false !default; -// $include_LayerList: false !default; -// $include_Legend: false !default; -$include_LineOfSight: false !default; -$include_Measurement: false !default; -$include_NavigationToggle: false !default; -$include_OpacitySlider: false !default; -$include_Print: false !default; -// $include_Popup: false !default; -$include_ScaleBar: false !default; -$include_ScaleRangeSlider: false !default; -// $include_Search: false !default; -$include_SizeSlider: false !default; -$include_Sketch: false !default; -$include_Slice: false !default; -$include_Slider: false !default; -$include_Spinner: false !default; -$include_Swipe: false !default; -$include_TableList: false !default; -$include_TimePicker: false !default; -$include_TimeSlider: false !default; -// $include_Zoom: false !default; - -// How to switch up the API font family. -// @import url("https://fonts.googleapis.com/css?family=Roboto:400,500,700&display=swap"); -// $font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !default; - -// Core will do the rest. -// This is the file to start with to understand the API theming system or to make advanced theming changes. -@import "~@arcgis/core/assets/esri/themes/base/core"; - -/************************************************* - Add application and widget styles. -*************************************************/ - -html, -body { - padding: 0; - margin: 0; - height: 100%; - width: 100%; - font-family: $font-family; - font-size: 14px; -} - -.app { - display: flex; - flex-flow: column; - width: 100%; - height: 100%; - padding: 0; - margin: 0; - overflow: hidden; -} - -.app--header { - display: flex; - flex-flow: row; - justify-content: space-between; - align-items: center; - height: 40px; - width: 100%; - background-color: $Brand_Blue_200; - color: $Calcite_Gray_050; -} - -.app--header-title { - font-size: 20px; - font-weight: 500; - margin-left: 0.5rem; -} - -@media screen and (min-width: 880px) { - .app--header-search.esri-search { - width: 340px; - } -} -@media screen and (min-width: 1280px) { - .app--header-search.esri-search { - width: 640px; - } -} - -.app--view { - width: 100%; - height: calc(100% - 40px); -} diff --git a/templates/webpack/app/src/index.ts b/templates/webpack/app/src/index.ts deleted file mode 100755 index 83ce8f9..0000000 --- a/templates/webpack/app/src/index.ts +++ /dev/null @@ -1,30 +0,0 @@ -import config from '@arcgis/core/config'; -import Map from '@arcgis/core/Map'; -import MapView from '@arcgis/core/views/MapView'; -import FeatureLayer from '@arcgis/core/layers/FeatureLayer'; -import { initWidgets } from './widgets'; - -config.apiKey = process.env.API_KEY as string; - -const featureLayer = new FeatureLayer({ - portalItem: { - id: 'b234a118ab6b4c91908a1cf677941702', - }, - outFields: ['NAME', 'STATE_NAME', 'VACANT', 'HSE_UNITS'], - title: 'U.S. Counties', - opacity: 0.8, -}); - -featureLayer.when(() => { - view.goTo(featureLayer.fullExtent); -}); - -const view = new MapView({ - container: 'viewDiv', - map: new Map({ - basemap: 'arcgis-topographic', - layers: [featureLayer], - }), -}); - -view.when(() => initWidgets({ view, layer: featureLayer })); diff --git a/templates/webpack/app/src/oauth-callback.html b/templates/webpack/app/src/oauth-callback.html deleted file mode 100644 index 33177c9..0000000 --- a/templates/webpack/app/src/oauth-callback.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/templates/webpack/app/src/widgets.spec.ts b/templates/webpack/app/src/widgets.spec.ts deleted file mode 100644 index 8ddd411..0000000 --- a/templates/webpack/app/src/widgets.spec.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { initWidgets } from './widgets'; - -jest.mock('@arcgis/core/widgets/LayerList'); -jest.mock('@arcgis/core/widgets/Legend'); - -let spy: jest.SpyInstance; - -describe('widgets', () => { - beforeEach(() => { - spy = jest.spyOn(document, 'getElementById'); - const mockElem: unknown = { - offsetWidth: 300, - }; - spy.mockReturnValue(mockElem); - }); - - it('initializes widgets in view', () => { - const widgets: unknown[] = []; - const view: any = { - ui: { - add(w: unknown) { - widgets.push(w); - }, - }, - }; - - const layer: any= {} - - initWidgets({ view, layer }); - expect(widgets).toHaveLength(2); - }); -}); diff --git a/templates/webpack/app/src/widgets.ts b/templates/webpack/app/src/widgets.ts deleted file mode 100644 index b639c8a..0000000 --- a/templates/webpack/app/src/widgets.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Widgets -import FeatureLayer from '@arcgis/core/layers/FeatureLayer'; -import MapView from '@arcgis/core/views/MapView'; -import LayerList from '@arcgis/core/widgets/LayerList'; -import Legend from '@arcgis/core/widgets/Legend'; -import Search from '@arcgis/core/widgets/Search'; -import LayerSearchSource from '@arcgis/core/widgets/Search/LayerSearchSource'; - -interface Params { - view: MapView; - layer: FeatureLayer; -} - -export function initWidgets({ view, layer }: Params): MapView { - const legend = new Legend({ view }); - const layerList = new LayerList({ view }); - view.ui.add(legend, 'bottom-left'); - view.ui.add(layerList, 'top-right'); - new Search({ - container: 'searchDiv', - sources: [ - new LayerSearchSource({ - layer, - outFields: ['NAME', 'STATE_NAME', 'VACANT', 'HSE_UNITS'], - searchFields: ['NAME'], - suggestionTemplate: '{NAME} County, {STATE_NAME}', - placeholder: 'Search by County Name', - }), - ], - }); - return view; -} diff --git a/templates/webpack/app/tsconfig.json b/templates/webpack/app/tsconfig.json deleted file mode 100644 index e587356..0000000 --- a/templates/webpack/app/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "moduleResolution": "node", - "strict": true, - "esModuleInterop": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noEmit": true - }, - "include": [ - "src/**/*", - ] -} diff --git a/templates/webpack/app/webpack.config.js b/templates/webpack/app/webpack.config.js deleted file mode 100644 index 63fe53b..0000000 --- a/templates/webpack/app/webpack.config.js +++ /dev/null @@ -1,246 +0,0 @@ -import ArcGISPlugin from '@arcgis/webpack-plugin'; -import CssMinimizerPlugin from 'css-minimizer-webpack-plugin'; -import Dotenv from 'dotenv-webpack'; -import TerserPlugin from 'terser-webpack-plugin'; -import HtmlWebPackPlugin from 'html-webpack-plugin'; -import MiniCssExtractPlugin from 'mini-css-extract-plugin'; -import HTMLInlineCSSWebpackPlugin from 'html-inline-css-webpack-plugin'; -import CopyPlugin from 'copy-webpack-plugin'; -import { GenerateSW } from 'workbox-webpack-plugin'; - -/** - * Application options. - */ - -// Application information. -const title = 'ArcGIS Webpack Template'; -const description = 'ArcGIS API for JavaScript Webpack template application.'; -const themeColor = '#007ac2'; -const deployUrl = 'https://localhost:8080/'; -const appImageUrl = 'socialcard.png'; - -// HTML plugin options for index.ejs. Primarily for title and meta tags. -// Mixes in...be careful. -// https://github.com/jantimon/html-webpack-plugin#options -const indexHtml = { - hash: true, - title, - meta: { - viewport: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no', - 'mobile-web-app-capable': 'yes', - 'apple-mobile-web-app-capable': 'yes', - 'theme-color': themeColor, - 'og:url': deployUrl, - 'og:type': 'website', - 'og:site_name': title, - 'og:title': title, - 'og:description': description, - 'og:image': appImageUrl, - }, -}; - -/** - * Webpack options. - */ - -// Output public path. -// Single page/routing apps must set to '/'. -// https://webpack.js.org/configuration/output/#outputpublicpath -const outputPublicPath = ''; - -// Dev server options. -// https://webpack.js.org/configuration/dev-server/ -const devServer = { - compress: true, - https: false, - port: 8080, - open: true, -}; - -// Webpack devtool for source map generation. -// https://webpack.js.org/configuration/devtool/ -const developmentDevtool = 'eval'; -const productionDevtool = false; - -// Workbox service workers. -// Important! Read up on and understand Workbox before use: https://developers.google.com/web/tools/workbox -// There are potential browser cache pitfalls and other repercussions for deploying an app with Workbox. -const workbox = false; -// Exclude files or patterns from Workbox. -const workboxExcludes = []; - -/** - * Webpack configuration. - * - * Editing only required to add additional plugins or effect how Webpack operates. - */ -export default (_, args) => { - const mode = args.mode; - - const config = { - // https://webpack.js.org/configuration/node/ - node: false, - - // Entry points. - entry: { - index: ['./src/index.scss', './src/index.ts'], - }, - - // Output parameters. - output: { - filename: '[name].[chunkhash].js', - chunkFilename: 'chunks/[id].js', - publicPath: outputPublicPath, - clean: true - }, - - // Development server parameters (provided in Webpack options above). - devServer, - - devtool: mode === 'development' ? developmentDevtool : productionDevtool, - - // Optimize output in production only. - optimization: { - minimize: mode === 'production', - splitChunks: { minChunks: Infinity, chunks: 'all' }, - minimizer: [ - new TerserPlugin({ - parallel: true, - terserOptions: { - output: { - comments: false, - }, - }, - }), - new CssMinimizerPlugin(), - ], - runtimeChunk: { - name: 'runtime', - }, - }, - - // Module handling and loaders. - module: { - rules: [ - { - test: /\.tsx?$/, - use: [ - { - loader: 'ts-loader', - options: { - transpileOnly: true, - }, - }, - ], - }, - { - test: /\.(ttf|eot|svg|png|jpg|gif|ico|wsv|otf|woff(2)?)(\?[a-z0-9]+)?$/, - use: [ - { - loader: 'file-loader', - }, - ], - }, - { - test: /\.scss$/, - use: [ - MiniCssExtractPlugin.loader, - { - loader: 'css-loader', - options: { - sourceMap: true, - url: false, - importLoaders: 2, - }, - }, - { - loader: 'resolve-url-loader', - options: { - sourceMap: true, - debug: mode === 'development', - join: (_rul_uri, _rul_base) => { - // args must be included - return (arg) => { - // ArcGISPlugin copies assets and cannot be resolved when using api sass - // replace relative path with absolute path in `dist` so files can be found for resolving - return arg.bases.value.includes("@arcgis/core") - ? arg.uri.replace("../", "./assets/esri/themes/") - : arg.uri; - }; - }, - }, - }, - { - loader: 'sass-loader', - options: { - sourceMap: true, - }, - }, - ], - }, - ], - }, - - // Configure how modules are resolved. - resolve: { - extensions: ['.ts', '.tsx', '.js', '.scss', '.css'], - }, - - // Webpack plugins. - plugins: [ - new Dotenv({ - path: './.env.local' - }), - - new ArcGISPlugin(), - - new HtmlWebPackPlugin({ - template: './src/index.ejs', - filename: 'index.html', - chunksSortMode: 'none', - mode: mode, - showErrors: mode === 'development', - ...indexHtml, - }), - - new HtmlWebPackPlugin({ - template: './src/oauth-callback.html', - filename: 'oauth-callback.html', - inject: false, - }), - - new MiniCssExtractPlugin({ - filename: '[name].[chunkhash].css', - chunkFilename: '[id].css', - }), - - new HTMLInlineCSSWebpackPlugin.default({ - filter: (fileName) => { - return fileName.includes('index'); - }, - }), - - new CopyPlugin({ - patterns: [ - { - context: 'src/assets/', - from: '**/*', - }, - ], - }), - ], - }; - - // Workbox plugin. - if (mode === 'production' && workbox) { - config.plugins.push( - new GenerateSW({ - clientsClaim: true, - skipWaiting: true, - exclude: [...workboxExcludes], - }), - ); - } - - return config; -};