Skip to content

Commit

Permalink
First NPM Release (#15)
Browse files Browse the repository at this point in the history
* Prepare openmrs CLI

* Started working on 2 new commands

* Finished assemble command

* Updated with keywords

* Fixed

* Enhanced console rule

* Updated to aligned version 3.0.1, publish on tag

* Updated dependencies

* Use standalone debugger

* Updated debug runner

* Introduced spa environment

* Added env
  • Loading branch information
FlorianRappl authored Oct 8, 2020
1 parent cbddc8a commit f096fea
Show file tree
Hide file tree
Showing 39 changed files with 657 additions and 229 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ typings/

# Optional npm cache directory
.npm
.cache

# Optional eslint cache
.eslintcache
Expand Down
28 changes: 17 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ script:
- cp packages/esm-app-shell/dist/*.* dist/@openmrs/esm-app-shell/$TRAVIS_COMMIT/
- cp packages/esm-app-shell/dist/*.* dist/@openmrs/esm-app-shell/latest/
deploy:
provider: s3
access_key_id: "$DIGITAL_OCEAN_SPACES_KEY_ID"
secret_access_key: "$DIGITAL_OCEAN_SPACES_ACCESS_KEY"
bucket: "$DIGITAL_OCEAN_SPACES_BUCKET"
endpoint: "$DIGITAL_OCEAN_SPACES_ENDPOINT"
cache-control: "max-age=31536000"
local_dir: dist
skip_cleanup: true
acl: public_read
on:
branch: master
- provider: s3
access_key_id: "$DIGITAL_OCEAN_SPACES_KEY_ID"
secret_access_key: "$DIGITAL_OCEAN_SPACES_ACCESS_KEY"
bucket: "$DIGITAL_OCEAN_SPACES_BUCKET"
endpoint: "$DIGITAL_OCEAN_SPACES_ENDPOINT"
cache-control: "max-age=31536000"
local_dir: dist
skip_cleanup: true
acl: public_read
on:
branch: master
- provider: npm
run_script: "ci:publish"
api_token: "$NPM_AUTH_TOKEN"
edge: true
on:
tags: true
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"packages": ["packages/*"],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.2.0"
"version": "3.0.1"
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
],
"scripts": {
"run:shell": "lerna run watch --scope @openmrs/esm-app-shell --stream",
"run:omrs": "run-openmrs",
"run:omrs": "openmrs",
"ci:publish": "lerna publish from-package --yes",
"verify": "lerna run lint && lerna run test && lerna run typescript",
"prettier": "prettier 'packages/**/src/**/*' --write"
},
Expand Down
7 changes: 4 additions & 3 deletions packages/esm-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openmrs/esm-api",
"version": "3.1.0",
"version": "3.0.1",
"license": "MPL-2.0",
"description": "The javascript module for interacting with the OpenMRS API",
"browser": "dist/openmrs-esm-api.js",
Expand All @@ -12,6 +12,7 @@
"typescript": "tsc",
"lint": "eslint src --ext ts,tsx"
},
"keywords": ["openmrs", "microfrontends"],
"directories": {
"lib": "dist",
"src": "src"
Expand Down Expand Up @@ -40,8 +41,8 @@
"single-spa": "4.x"
},
"devDependencies": {
"@openmrs/esm-config": "^0.3.0",
"@openmrs/esm-error-handling": "^1.3.0",
"@openmrs/esm-config": "^3.0.1",
"@openmrs/esm-error-handling": "^3.0.1",
"@types/fhir": "0.0.31",
"@types/react": "^16.9.46",
"react": "^16.13.1",
Expand Down
6 changes: 6 additions & 0 deletions packages/esm-api/src/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export function isDevEnabled() {
return (
window.spaEnv === "development" ||
localStorage.getItem("openmrs:devtools") === "true"
);
}
13 changes: 7 additions & 6 deletions packages/esm-app-shell/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openmrs/esm-app-shell",
"version": "0.3.0",
"version": "3.0.1",
"license": "MPL-2.0",
"main": "dist/openmrs.js",
"scripts": {
Expand All @@ -10,6 +10,7 @@
"watch": "webpack-dev-server",
"lint": "eslint src --ext ts,tsx"
},
"keywords": ["openmrs", "microfrontends"],
"browserslist": [
"extends browserslist-config-openmrs"
],
Expand All @@ -22,11 +23,11 @@
},
"homepage": "https://github.com/openmrs/openmrs-esm-core#readme",
"dependencies": {
"@openmrs/esm-api": "^3.1.0",
"@openmrs/esm-config": "^0.3.0",
"@openmrs/esm-error-handling": "^1.3.0",
"@openmrs/esm-extensions": "^0.3.0",
"@openmrs/esm-styleguide": "^1.5.0",
"@openmrs/esm-api": "^3.0.1",
"@openmrs/esm-config": "^3.0.1",
"@openmrs/esm-error-handling": "^3.0.1",
"@openmrs/esm-extensions": "^3.0.1",
"@openmrs/esm-styleguide": "^3.0.1",
"carbon-components": "^10.19.0",
"carbon-icons": "^7.0.7",
"i18next": "^19.6.0",
Expand Down
1 change: 1 addition & 0 deletions packages/esm-app-shell/src/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
initializeSpa({
apiUrl: "<%= openmrsApiUrl %>",
spaPath: "<%= openmrsPublicPath %>",
env: "<%= openmrsEnvironment %>",
});
</script>
</body>
Expand Down
1 change: 1 addition & 0 deletions packages/esm-app-shell/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function runShell() {
function setupPaths(config: SpaConfig) {
window.openmrsBase = config.apiUrl;
window.spaBase = config.spaPath;
window.spaEnv = config.env || "production";
window.getOpenmrsSpaBase = () => `${window.spaBase}/`;
}

Expand Down
8 changes: 8 additions & 0 deletions packages/esm-app-shell/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ declare global {
getOpenmrsSpaBase(): string;
openmrsBase: string;
spaBase: string;
spaEnv: SpaEnvironment;
importMapOverrides: {
getCurrentPageMap: () => Promise<ImportMap>;
};
}
}

export type SpaEnvironment = "production" | "development" | "test";

export interface ImportMap {
imports: Record<string, string>;
}
Expand All @@ -22,6 +25,11 @@ export interface SpaConfig {
* The base path for the SPA root path.
*/
spaPath: string;
/**
* The environment to use.
* @default production
*/
env?: SpaEnvironment;
}

export interface Activator {
Expand Down
2 changes: 2 additions & 0 deletions packages/esm-app-shell/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const openmrsProxyTarget =
process.env.OMRS_PROXY_TARGET || "https://openmrs-spa.org/";
const openmrsFavicon = process.env.OMRS_FAVICON || "favicon.ico";
const openmrsImportmapDef = process.env.OMRS_ESM_IMPORTMAP;
const openmrsEnvironment = process.env.OMRS_ENV || process.env.NODE_ENV || '';
const openmrsImportmapUrl =
process.env.OMRS_ESM_IMPORTMAP_URL || "importmap.json";

Expand Down Expand Up @@ -111,6 +112,7 @@ module.exports = {
openmrsFavicon,
openmrsImportmapDef,
openmrsImportmapUrl,
openmrsEnvironment,
},
}),
new CopyWebpackPlugin({
Expand Down
3 changes: 2 additions & 1 deletion packages/esm-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openmrs/esm-config",
"version": "0.3.0",
"version": "3.0.1",
"license": "MPL-2.0",
"description": "A configuration library for the OpenMRS Single-Spa framework.",
"browser": "dist/openmrs-esm-module-config.js",
Expand All @@ -13,6 +13,7 @@
"typescript": "tsc",
"lint": "eslint src --ext ts,tsx"
},
"keywords": ["openmrs", "microfrontends"],
"directories": {
"lib": "dist",
"src": "src"
Expand Down
5 changes: 3 additions & 2 deletions packages/esm-error-handling/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openmrs/esm-error-handling",
"version": "1.3.0",
"version": "3.0.1",
"license": "MPL-2.0",
"description": "An ES module to help with error handling",
"browser": "dist/openmrs-esm-error-handling.js",
Expand All @@ -12,6 +12,7 @@
"typescript": "tsc",
"lint": "eslint src --ext ts,tsx"
},
"keywords": ["openmrs", "microfrontends"],
"directories": {
"lib": "dist",
"src": "src"
Expand All @@ -34,6 +35,6 @@
"@openmrs/esm-styleguide": "*"
},
"devDependencies": {
"@openmrs/esm-styleguide": "^1.5.0"
"@openmrs/esm-styleguide": "^3.0.1"
}
}
8 changes: 3 additions & 5 deletions packages/esm-extensions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openmrs/esm-extensions",
"version": "0.3.0",
"version": "3.0.1",
"license": "MPL-2.0",
"description": "Coordinates extensions and extension points in the OpenMRS Frontend",
"browser": "dist/openmrs-esm-extensions.js",
Expand All @@ -12,6 +12,7 @@
"typescript": "tsc",
"lint": "eslint src --ext ts,tsx"
},
"keywords": ["openmrs", "microfrontends"],
"directories": {
"lib": "dist",
"src": "src"
Expand All @@ -27,9 +28,6 @@
"url": "https://github.com/openmrs/openmrs-esm-core/issues"
},
"homepage": "https://github.com/openmrs/openmrs-esm-core#readme",
"keywords": [
"openmrs"
],
"dependencies": {
"systemjs-webpack-interop": "^2.1.2"
},
Expand All @@ -39,7 +37,7 @@
"single-spa": "4.x"
},
"devDependencies": {
"@openmrs/esm-config": "^0.3.0",
"@openmrs/esm-config": "^3.0.1",
"@types/react": "^16.9.46",
"react": "^16.13.1",
"single-spa": "^4.4.1"
Expand Down
7 changes: 2 additions & 5 deletions packages/esm-styleguide/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openmrs/esm-styleguide",
"version": "1.5.0",
"version": "3.0.1",
"license": "MPL-2.0",
"description": "The styleguide for OpenMRS SPA",
"browser": "dist/openmrs-esm-styleguide.js",
Expand All @@ -13,6 +13,7 @@
"build": "webpack --mode=production",
"lint": "eslint src"
},
"keywords": ["openmrs", "microfrontends", "styleguide"],
"directories": {
"lib": "dist",
"src": "src"
Expand All @@ -24,10 +25,6 @@
"type": "git",
"url": "git+https://github.com/openmrs/openmrs-esm-core.git"
},
"keywords": [
"openmrs",
"styleguide"
],
"bugs": {
"url": "https://github.com/openmrs/openmrs-esm-core/issues"
},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "run-openmrs",
"version": "0.3.0",
"name": "openmrs",
"version": "3.0.1",
"license": "MPL-2.0",
"main": "dist/index.js",
"bin": {
"run-openmrs": "./dist/cli.js"
"openmrs": "./dist/cli.js"
},
"scripts": {
"start": "npm run watch",
Expand All @@ -19,16 +19,18 @@
"bugs": {
"url": "https://github.com/openmrs/openmrs-esm-core/issues"
},
"keywords": ["openmrs", "microfrontends", "cli", "tool"],
"homepage": "https://github.com/openmrs/openmrs-esm-core#readme",
"dependencies": {
"@babel/core": "^7.11.4",
"@babel/preset-env": "^7.11.0",
"@babel/preset-react": "^7.10.4",
"@babel/preset-typescript": "^7.10.4",
"@openmrs/esm-app-shell": "^0.3.0",
"@openmrs/esm-app-shell": "^3.0.1",
"@types/react": "^16.9.46",
"@types/systemjs": "^6.1.0",
"autoprefixer": "^9.6.1",
"axios": "0.20.0",
"babel-loader": "^8.1.0",
"browserslist-config-openmrs": "^1.0.1",
"clean-webpack-plugin": "^3.0.0",
Expand All @@ -39,15 +41,21 @@
"file-loader": "^4.2.0",
"fork-ts-checker-webpack-plugin": "^5.1.0",
"html-webpack-plugin": "^4.5.0",
"inquirer": "^7.3.3",
"mini-css-extract-plugin": "^0.8.0",
"postcss-loader": "^4.0.2",
"raw-loader": "^3.1.0",
"style-loader": "^1.0.0",
"tar": "^6.0.5",
"ts-loader": "^8.0.3",
"typescript": "^4.0.2",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"yargs": "16.0.3"
},
"devDependencies": {
"@types/inquirer": "^6.5.0",
"@types/tar": "^4.0.3"
}
}
Loading

0 comments on commit f096fea

Please sign in to comment.