-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d334fbf
Showing
12 changed files
with
245 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": [ "apostrophe", "plugin:vue/vue3-recommended" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: tests | ||
|
||
# Controls when the action will run. | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ '*' ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [16, 18, 20] | ||
mongodb-version: ['4.4', '5.0', '6.0'] | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Start MongoDB | ||
uses: supercharge/[email protected] | ||
with: | ||
mongodb-version: ${{ matrix.mongodb-version }} | ||
|
||
- run: npm install | ||
|
||
- run: npm test | ||
env: | ||
CI: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Ignore MacOS X metadata forks (fusefs) | ||
._* | ||
package-lock.json | ||
*.DS_Store | ||
node_modules | ||
|
||
# Never commit a CSS map file, anywhere | ||
*.css.map | ||
|
||
# vim swp files | ||
.*.sw* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "stylelint-config-apostrophe" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Changelog | ||
|
||
## 1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright (c) 2023 Apostrophe Technologies | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
**TODO:** Update the badge URLs for the new module's repo. | ||
|
||
<div align="center"> | ||
<img src="https://raw.githubusercontent.com/apostrophecms/apostrophe/main/logo.svg" alt="ApostropheCMS logo" width="80" height="80"> | ||
|
||
<h1>Apostrophe Module Template</h1> | ||
<p> | ||
<a aria-label="Apostrophe logo" href="https://v3.docs.apostrophecms.org"> | ||
<img src="https://img.shields.io/badge/MADE%20FOR%20Apostrophe%203-000000.svg?style=for-the-badge&logo=Apostrophe&labelColor=6516dd"> | ||
</a> | ||
<a aria-label="Test status" href="https://github.com/apostrophecms/apostrophe/actions"> | ||
<img alt="GitHub Workflow Status (branch)" src="https://img.shields.io/github/workflow/status/apostrophecms/apostrophe/Tests/main?label=Tests&labelColor=000000&style=for-the-badge"> | ||
</a> | ||
<a aria-label="Join the community on Discord" href="http://chat.apostrophecms.org"> | ||
<img alt="" src="https://img.shields.io/discord/517772094482677790?color=5865f2&label=Join%20the%20Discord&logo=discord&logoColor=fff&labelColor=000&style=for-the-badge&logoWidth=20"> | ||
</a> | ||
<a aria-label="License" href="https://github.com/apostrophecms/module-template/blob/main/LICENSE.md"> | ||
<img alt="" src="https://img.shields.io/static/v1?style=for-the-badge&labelColor=000000&label=License&message=MIT&color=3DA639"> | ||
</a> | ||
</p> | ||
</div> | ||
|
||
This module template serves as a starting point for new official Apostrophe modules. This is where you would describe what the purpose of the module is. | ||
|
||
## Installation | ||
|
||
To install the module, use the command line to run this command in an Apostrophe project's root directory: | ||
|
||
``` | ||
npm install @apostrophecms/module-template | ||
``` | ||
|
||
## Usage | ||
|
||
Configure the _______ module in the `app.js` file: | ||
|
||
```javascript | ||
require('apostrophe')({ | ||
shortName: 'my-project', | ||
modules: { | ||
'@apostrophecms/module-template': {} | ||
} | ||
}); | ||
``` | ||
|
||
### Additional usage sections | ||
|
||
### Pre-release checks | ||
|
||
- [ ] If the module does not include CSS, remove the Stylelint config file and dependency `npm remove --save-dev stylelint stylelint-config-apostrophe` | ||
- [ ] If the module does not include any Vue.js components, remove | ||
- [ ] set in `package.json`, `"eslint": "eslint .",` | ||
- [ ] remove Vue.js packages `npm remove --save-dev eslint-plugin-vue vue-eslint-parser` | ||
- [ ] If the module does not contains any tests, remove mocha `npm remove --save-dev mocha` | ||
- [ ] If this file contains images, please use public static endpoint to load the images. | ||
- [ ] If any template includes a script with inline code, include the `nonce` attribute set like this: `<script nonce="{{ nonce }}">`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
bundle: { | ||
directory: 'modules', | ||
modules: getBundleModuleNames() | ||
} | ||
}; | ||
|
||
function getBundleModuleNames() { | ||
const source = path.join(__dirname, './modules/@apostrophecms'); | ||
return fs | ||
.readdirSync(source, { withFileTypes: true }) | ||
.filter(dirent => dirent.isDirectory()) | ||
.map(dirent => `@apostrophecms/${dirent.name}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "@apostrophecms/module-template", | ||
"version": "1.0.0", | ||
"description": "A template for creating an ApostropheCMS 3 module.", | ||
"main": "index.js", | ||
"scripts": { | ||
"eslint": "eslint --ext .js,.vue .", | ||
"lint": "npm run eslint", | ||
"test": "npm run lint && mocha" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/apostrophecms/module-template.git" | ||
}, | ||
"homepage": "https://github.com/apostrophecms/module-template#readme", | ||
"author": "Apostrophe Technologies", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"apostrophe": "github:apostrophecms/apostrophe", | ||
"eslint": "^8.44.0", | ||
"eslint-config-apostrophe": "^4.0.0", | ||
"eslint-config-standard": "^17.1.0", | ||
"eslint-plugin-import": "^2.22.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^6.1.1", | ||
"eslint-plugin-standard": "^5.0.0", | ||
"eslint-plugin-vue": "^9.15.1", | ||
"mocha": "^10.2.0", | ||
"stylelint": "^15.9.0", | ||
"stylelint-config-apostrophe": "^3.0.0", | ||
"vue-eslint-parser": "^9.3.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const assert = require('assert').strict; | ||
const t = require('apostrophe/test-lib/util.js'); | ||
|
||
const getAppConfig = () => { | ||
return { | ||
'@apostrophecms/express': { | ||
options: { | ||
session: { secret: 'supersecret' } | ||
} | ||
}, | ||
'@apostrophecms/module': { | ||
options: { | ||
} | ||
} | ||
}; | ||
}; | ||
|
||
describe('@apostrophecms/module', function () { | ||
let apos; | ||
|
||
this.timeout(t.timeout); | ||
|
||
after(function () { | ||
return t.destroy(apos); | ||
}); | ||
|
||
before(async function() { | ||
apos = await t.create({ | ||
root: module, | ||
baseUrl: 'http://localhost:3000', | ||
testModule: true, | ||
modules: getAppConfig() | ||
}); | ||
}); | ||
|
||
describe('init', function() { | ||
it('should have module enabled', function () { | ||
const actual = Object.keys(apos.modules).includes('@apostrophecms/module'); | ||
const expected = true; | ||
|
||
assert.equal(actual, expected); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"/**": "This package.json file is not actually installed.", | ||
" * ": "Apostrophe requires that all npm modules to be loaded by moog", | ||
" */": "exist in package.json at project level, which for a test is here", | ||
"dependencies": { | ||
"apostrophe": "git+https://github.com/apostrophecms/apostrophe.git", | ||
"@apostrophecms/module": "git+https://github.com/apostrophecms/module.git" | ||
} | ||
} |