Skip to content

Commit

Permalink
build: generate jsdoc from src instead of lib (#14094) (#14096)
Browse files Browse the repository at this point in the history
  • Loading branch information
ephys authored Feb 11, 2022
1 parent b95c213 commit 664bd12
Show file tree
Hide file tree
Showing 16 changed files with 455 additions and 454 deletions.
22 changes: 11 additions & 11 deletions docs/ROUTER.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
301 /en/latest/docs/getting-started/ https://sequelize.org/master/manual/getting-started.html
301 /en/latest/docs/:section/ https://sequelize.org/master/manual/:section.html

301 /en/latest/api/sequelize/ https://sequelize.org/master/class/lib/sequelize.js~Sequelize.html
301 /en/latest/api/model/ https://sequelize.org/master/class/lib/model.js~Model.html
301 /en/latest/api/instance/ https://sequelize.org/master/class/lib/model.js~Model.html
301 /en/latest/api/associations/ https://sequelize.org/master/class/lib/associations/base.js~Association.html
301 /en/latest/api/associations/belongs-to/ https://sequelize.org/master/class/lib/associations/belongs-to.js~BelongsTo.html
301 /en/latest/api/associations/belongs-to-many/ https://sequelize.org/master/class/lib/associations/belongs-to-.many.js~BelongsToMany.html
301 /en/latest/api/associations/has-one/ https://sequelize.org/master/class/lib/associations/has-one.js~HasOne.html
301 /en/latest/api/associations/has-many/ https://sequelize.org/master/class/lib/associations/has-many.js~HasMany.html
301 /en/latest/api/transaction/ https://sequelize.org/master/class/lib/transaction.js~Transaction.html
301 /en/latest/api/sequelize/ https://sequelize.org/master/class/src/sequelize.js~Sequelize.html
301 /en/latest/api/model/ https://sequelize.org/master/class/src/model.js~Model.html
301 /en/latest/api/instance/ https://sequelize.org/master/class/src/model.js~Model.html
301 /en/latest/api/associations/ https://sequelize.org/master/class/src/associations/base.js~Association.html
301 /en/latest/api/associations/belongs-to/ https://sequelize.org/master/class/src/associations/belongs-to.js~BelongsTo.html
301 /en/latest/api/associations/belongs-to-many/ https://sequelize.org/master/class/src/associations/belongs-to-.many.js~BelongsToMany.html
301 /en/latest/api/associations/has-one/ https://sequelize.org/master/class/src/associations/has-one.js~HasOne.html
301 /en/latest/api/associations/has-many/ https://sequelize.org/master/class/src/associations/has-many.js~HasMany.html
301 /en/latest/api/transaction/ https://sequelize.org/master/class/src/transaction.js~Transaction.html
301 /en/latest/api/datatypes/ https://sequelize.org/master/variable/index.html#static-variable-DataTypes
301 /en/latest/api/deferrable/ https://sequelize.org/master/variable/index.html#static-variable-Deferrable
301 /en/latest/api/errors/ https://sequelize.org/master/class/lib/errors/base-error.js~BaseError.html
301 /en/latest/api/errors/ https://sequelize.org/master/class/src/errors/base-error.js~BaseError.html

301 /manual/tutorial/:section.html https://sequelize.org/master/manual/:section.html
301 /manual/installation/:section.html https://sequelize.org/master/manual/:section.html
Expand All @@ -33,4 +33,4 @@
301 /:foo/:bar/:baz https://sequelize.org/master/:foo/:bar/:baz
301 /:foo/:bar/:baz/:quz https://sequelize.org/master/:foo/:bar/:baz/:quz

301 / https://sequelize.org/
301 / https://sequelize.org/
2 changes: 1 addition & 1 deletion docs/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,6 @@ header a {
}

a[href="source.html"],
a[href^="file/lib/"] {
a[href^="file/src/"] {
display: none;
}
3 changes: 2 additions & 1 deletion docs/esdoc-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ const { getDeclaredManuals, checkManuals } = require('./manual-utils');
checkManuals();

module.exports = {
source: './lib',
source: './src',
destination: './esdoc',
includes: ['\\.[tj]s$'],
excludes: ['\\.d.ts$'],
plugins: [
{
name: 'esdoc-ecmascript-proposal-plugin',
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/core-concepts/assocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ The above showed the basics on queries for fetching data involving associations.

* Or use the *[special methods/mixins](#special-methods-mixins-added-to-instances)* available for associated models, which are explained later on this page.

**Note:** The [`save()` instance method](../class/lib/model.js~Model.html#instance-method-save) is not aware of associations. In other words, if you change a value from a *child* object that was eager loaded along a *parent* object, calling `save()` on the parent will completely ignore the change that happened on the child.
**Note:** The [`save()` instance method](../class/src/model.js~Model.html#instance-method-save) is not aware of associations. In other words, if you change a value from a *child* object that was eager loaded along a *parent* object, calling `save()` on the parent will completely ignore the change that happened on the child.

## Association Aliases & Custom Foreign Keys

Expand Down
2 changes: 1 addition & 1 deletion docs/manual/core-concepts/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const sequelize = new Sequelize('database', 'username', 'password', {
});
```

The Sequelize constructor accepts a lot of options. They are documented in the [API Reference](../class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor).
The Sequelize constructor accepts a lot of options. They are documented in the [API Reference](../class/src/sequelize.js~Sequelize.html#instance-constructor-constructor).

### Testing the connection

Expand Down
16 changes: 8 additions & 8 deletions docs/manual/core-concepts/model-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ In this tutorial you will learn what models are in Sequelize and how to use them

## Concept

Models are the essence of Sequelize. A model is an abstraction that represents a table in your database. In Sequelize, it is a class that extends [Model](../class/lib/model.js~Model.html).
Models are the essence of Sequelize. A model is an abstraction that represents a table in your database. In Sequelize, it is a class that extends [Model](../class/src/model.js~Model.html).

The model tells Sequelize several things about the entity it represents, such as the name of the table in the database and which columns it has (and their data types).

Expand All @@ -14,16 +14,16 @@ A model in Sequelize has a name. This name does not have to be the same name of

Models can be defined in two equivalent ways in Sequelize:

* Calling [`sequelize.define(modelName, attributes, options)`](../class/lib/sequelize.js~Sequelize.html#instance-method-define)
* Extending [Model](../class/lib/model.js~Model.html) and calling [`init(attributes, options)`](../class/lib/model.js~Model.html#static-method-init)
* Calling [`sequelize.define(modelName, attributes, options)`](../class/src/sequelize.js~Sequelize.html#instance-method-define)
* Extending [Model](../class/src/model.js~Model.html) and calling [`init(attributes, options)`](../class/src/model.js~Model.html#static-method-init)

After a model is defined, it is available within `sequelize.models` by its model name.

To learn with an example, we will consider that we want to create a model to represent users, which have a `firstName` and a `lastName`. We want our model to be called `User`, and the table it represents is called `Users` in the database.

Both ways to define this model are shown below. After being defined, we can access our model with `sequelize.models.User`.

### Using [`sequelize.define`](../class/lib/sequelize.js~Sequelize.html#instance-method-define):
### Using [`sequelize.define`](../class/src/sequelize.js~Sequelize.html#instance-method-define):

```js
const { Sequelize, DataTypes } = require('sequelize');
Expand All @@ -47,7 +47,7 @@ const User = sequelize.define('User', {
console.log(User === sequelize.models.User); // true
```

### Extending [Model](../class/lib/model.js~Model.html)
### Extending [Model](../class/src/model.js~Model.html)

```js
const { Sequelize, DataTypes, Model } = require('sequelize');
Expand Down Expand Up @@ -190,7 +190,7 @@ sequelize.define('User', {

When you define a model, you're telling Sequelize a few things about its table in the database. However, what if the table actually doesn't even exist in the database? What if it exists, but it has different columns, less columns, or any other difference?

This is where model synchronization comes in. A model can be synchronized with the database by calling [`model.sync(options)`](https://sequelize.org/master/class/lib/model.js~Model.html#static-method-sync), an asynchronous function (that returns a Promise). With this call, Sequelize will automatically perform an SQL query to the database. Note that this changes only the table in the database, not the model in the JavaScript side.
This is where model synchronization comes in. A model can be synchronized with the database by calling [`model.sync(options)`](https://sequelize.org/master/class/src/model.js~Model.html#static-method-sync), an asynchronous function (that returns a Promise). With this call, Sequelize will automatically perform an SQL query to the database. Note that this changes only the table in the database, not the model in the JavaScript side.

* `User.sync()` - This creates the table if it doesn't exist (and does nothing if it already exists)
* `User.sync({ force: true })` - This creates the table, dropping it first if it already existed
Expand All @@ -205,7 +205,7 @@ console.log("The table for the User model was just (re)created!");

### Synchronizing all models at once

You can use [`sequelize.sync()`](../class/lib/sequelize.js~Sequelize.html#instance-method-sync) to automatically synchronize all models. Example:
You can use [`sequelize.sync()`](../class/src/sequelize.js~Sequelize.html#instance-method-sync) to automatically synchronize all models. Example:

```js
await sequelize.sync({ force: true });
Expand Down Expand Up @@ -318,7 +318,7 @@ sequelize.define('Foo', {

## Data Types

Every column you define in your model must have a data type. Sequelize provides [a lot of built-in data types](https://github.com/sequelize/sequelize/blob/main/lib/data-types.js). To access a built-in data type, you must import `DataTypes`:
Every column you define in your model must have a data type. Sequelize provides [a lot of built-in data types](https://github.com/sequelize/sequelize/blob/main/src/data-types.js). To access a built-in data type, you must import `DataTypes`:

```js
const { DataTypes } = require("sequelize"); // Import the built-in data types
Expand Down
Loading

0 comments on commit 664bd12

Please sign in to comment.